Interface IRequestor


public interface IRequestor
Requestor represents an atomary operation performed during the injection. Injecting a field, or calling an injected method are examples of such operations.

When an injector is asked to do a task, it splits work into a set of requestors. Requestors are passed to relevant object suppliers so that requestors can be executed when values in the supplier change. (For instance, an object supplier that provided the value for the injected field, is expected to execute requestor again when it detects change in the injected value).

Since:
1.7
Restriction:
This interface is not intended to be implemented by clients.
Restriction:
This interface is not intended to be extended by clients.
  • Method Details

    • resolveArguments

      void resolveArguments(boolean initial) throws InjectionException
      Forces the requestor to resolve arguments it depends on.
      Parameters:
      initial - true if this is the initial attempt to resolve arguments
      Throws:
      InjectionException - if an exception occurred while performing this task
    • execute

      Object execute() throws InjectionException
      Call this method to perform requestor's task. This method should be called whenever the dependent value changes.
      Returns:
      result of the task
      Throws:
      InjectionException - if an exception occurred while performing this task
    • getRequestingObject

      Object getRequestingObject()
      The injected object that initiated this request
      Returns:
      the object that initiated this request, may return null
    • getRequestingObjectClass

      Class<?> getRequestingObjectClass()
      Class of the injected object
      Returns:
      class of the injected object, may return null
    • isValid

      boolean isValid()
      Determines if this requestor is still valid. Once requestor becomes invalid, it stays invalid. Invalid requestors can be safely removed from computations.
      Returns:
      true if this requestor is valid, false otherwise
    • disposed

      void disposed(PrimaryObjectSupplier objectSupplier) throws InjectionException
      Notifies the requestor that an object supplier has been disposed of.
      Parameters:
      objectSupplier - the object supplier being disposed of
      Throws:
      InjectionException - if an exception occurred while performing this task
    • uninject

      boolean uninject(Object object, PrimaryObjectSupplier objectSupplier) throws InjectionException
      Notifies the requestor that an object should be un-injected.
      Parameters:
      object - domain object that needs to be un-injected
      objectSupplier - the object supplier being un-injected
      Returns:
      true if the object was uninjected, false otherwise
      Throws:
      InjectionException - if an exception occurred while performing this task