Package jenkins.model

Class TransientActionFactory<T>

Type Parameters:
T - the type of object to add to; typically an Actionable subtype, but may specify a type such as TopLevelItem most of whose implementations are in fact Actionable
All Implemented Interfaces:
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.
See Also:
  • Constructor Details

    • TransientActionFactory

      public TransientActionFactory()
  • Method Details

    • type

      public abstract Class<T> type()
      The type of object this factory cares about. Declared separately, rather than by having createFor(T) do a check-cast, so that method bodies are not loaded until actually needed.
      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 to Action 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.

      a bound for the result of createFor(T)
    • 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.
      target - an actionable object
      a possible empty set of actions (typically either using Collections.emptySet() or Collections.singleton(T))
    • factoriesFor

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static Iterable<? extends TransientActionFactory<?>> factoriesFor(Class<?> type, Class<? extends Action> actionType)