Package jenkins.model
Class TransientActionFactory<T>
java.lang.Object
jenkins.model.TransientActionFactory<T>
- Type Parameters:
T
- the type of object to add to; typically anActionable
subtype, but may specify a type such asTopLevelItem
most of whose implementations are in factActionable
- All Implemented Interfaces:
ExtensionPoint
- Direct Known Subclasses:
RenameAction.TransientActionFactoryImpl
,SimpleBuildStep.LastBuildActionFactory
Allows you to add actions to any kind of object at once.
- Since:
- 1.548
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionA supertype of any actions this factory might produce.abstract Collection<? extends Action>
Creates actions for a given object.static Iterable<? extends TransientActionFactory<?>>
factoriesFor
(Class<?> type, Class<? extends Action> actionType) type()
The type of object this factory cares about.
-
Constructor Details
-
TransientActionFactory
public TransientActionFactory()
-
-
Method Details
-
type
The type of object this factory cares about. Declared separately, rather than by havingcreateFor(T)
do a check-cast, so that method bodies are not loaded until actually needed.- Returns:
- the type of
TransientActionFactory
-
actionType
A supertype of any actions this factory might produce. Defined so that factories which produce irrelevant actions need not be consulted by, e.g.,Actionable.getAction(Class)
. For historical reasons this defaults toAction
itself. If your implementation was returning multiple disparate kinds of actions, it is best to split it into two factories.If an API defines a abstract
Action
subtype and you are providing a concrete implementation, you may return the API type here to delay class loading.- Returns:
- a bound for the result of
createFor(T)
- Since:
- 2.34
-
createFor
Creates actions for a given object. This may be called frequently for the same object, so if your implementation is expensive, do your own caching.- Parameters:
target
- an actionable object- Returns:
- a possible empty set of actions (typically either using
Collections.emptySet()
orCollections.singleton(T)
)
-
factoriesFor
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static Iterable<? extends TransientActionFactory<?>> factoriesFor(Class<?> type, Class<? extends Action> actionType)
-