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
public abstract class TransientActionFactory<T> extends Object implements ExtensionPoint
Allows you to add actions to any kind of object at once.- Since:
- 1.548
- See Also:
Actionable.getAllActions()
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description TransientActionFactory()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Class<? extends Action>
actionType()
A supertype of any actions this factory might produce.abstract Collection<? extends Action>
createFor(T target)
Creates actions for a given object.static Iterable<? extends TransientActionFactory<?>>
factoriesFor(Class<?> type, Class<? extends Action> actionType)
abstract Class<T>
type()
The type of object this factory cares about.
-
-
-
Method Detail
-
type
public abstract Class<T> 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
public Class<? extends Action> 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
@NonNull public abstract Collection<? extends Action> createFor(@NonNull T target)
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)
-
-