Interface ISchedulableActionFactory

All Known Implementing Classes:
DefaultSchedulableActionFactory

public interface ISchedulableActionFactory
Interface for Factories for producing ISchedulableAction-s. SchedulableActions are IActions decorated with scheduling data. This factory is used by a Schedule to create ISchedulableAction that the Schedule can then schedule for execution.

The intention here is that an ISchedulableActionFactory will wrap an IActionFactory and use that IActionFactory to create IActions. The ISchedulableActionFactory will then take those IActions and "decorate" them with scheduling data to create ScheduableActions. In this way, the what (i.e. IAction) of scheduling is separated from the when (i.e. ISchedulableAction) of scheduling.

The ISchedulableActionFactory must respect the wrapped IAction's NonModelAction annotation by returning the corresponding value from its ISchedulableAction.isNonModelAction() method. For wrapped action with that annotation present, the ISchedulableAction's method should return true, otherwise it should return false.

Author:
Nick Collier
See Also:
  • Method Details

    • createAction

      ISchedulableAction createAction(ScheduleParameters scheduleParams, IAction action)
      Creates an ISchedulableAction from the specified scheduling parameters and executable IAction.
      Parameters:
      action - the action to execute
      scheduleParams - the scheduling data
      Returns:
      the created ISchedulableAction
    • createAction

      ISchedulableAction createAction(ScheduleParameters scheduleParams, Object target, String methodName, Object... parameters)
      Creates a ISchedulableAction from the specified scheduling parameters that will execute the named method on the target object with the specified parameters.
      Parameters:
      scheduleParams - the scheduling data
      target - the object on which to call the named method
      methodName - the name of the method to call
      parameters - the parameters to pass to the method
      Returns:
      the created ISchedulableAction
    • createActionForIterable

      ISchedulableAction createActionForIterable(ScheduleParameters scheduleParams, Iterable target, String methodName, boolean shuffle, Object... parameters)
      Creates a ISchedulableAction from the specified scheduling parameters that will execute the named method on the objects returned by target object with the specified parameters.
      Parameters:
      scheduleParams - the scheduling data
      target - the Iterable containing the objects on which to call the named method
      methodName - the name of the method to call
      shuffle - whether to shuffle the items in the iterable before calling the method on the objects therein
      parameters - the parameters to pass to the method
      Returns:
      the created ISchedulableAction
    • createAction

      ISchedulableAction createAction(Object annotatedObj, Object... parameters)
      Creates an ISchedulableACtion from ScheduleMethod annotated methods in the specified annotatedObj. The action will execute the method whose parameters best match the specified parameters. The parameters will be passed to the method at execution.
      Parameters:
      annotatedObj - the object containing the annotated methods
      parameters - the parameters to pass to the method call and to use to find the method itself
      Returns:
      the created ISchedulableAction
      See Also:
    • createAction

      ISchedulableAction createAction(ScheduleParameters scheduleParams, Object annotatedObj, Object... parameters)
      Creates an ISchedulableAction from ScheduleMethod annotated methods in the specified annotatedObj. The action will execute the method whose parameters best match the specified parameters. The parameters will be passed to the method at execution. The method will be executed according to the specified ScheduleParameters. The scheduling parameters derived from the annotation will be ignored.
      Parameters:
      scheduleParams - the scheduling parameters describing start time etc.
      annotatedObj - the object containing the annotated methods
      parameters - the parameters to pass to the method call and to use to find the method itself
      Returns:
      the created ISchedulableAction
      See Also:
    • createActions

      List<ISchedulableAction> createActions(Object obj)
      Creates a List of SchedulableActions from annotated methods. The list is created from the methods in the specified object that are annotated by the ScheduledMethod annotation.
      Parameters:
      obj - the object whose methods are annotated
      Returns:
      a List of ScheduableActions created from the annotated methods
      See Also:
    • getActionFactory

      IActionFactory getActionFactory()
      Gets the IActionFactory wrapped by the ISchedulableActionFactory.
      Returns:
      the IActionFactory wrapped by the ISchedulableActionFactory.