Package org.eclipse.e4.core.di.suppliers
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 Summary
Modifier and TypeMethodDescriptionvoiddisposed(PrimaryObjectSupplier objectSupplier) Notifies the requestor that an object supplier has been disposed of.execute()Call this method to perform requestor's task.The injected object that initiated this requestClass<?> Class of the injected objectbooleanisValid()Determines if this requestor is still valid.voidresolveArguments(boolean initial) Forces the requestor to resolve arguments it depends on.booleanuninject(Object object, PrimaryObjectSupplier objectSupplier) Notifies the requestor that an object should be un-injected.
-
Method Details
-
resolveArguments
Forces the requestor to resolve arguments it depends on.- Parameters:
initial-trueif this is the initial attempt to resolve arguments- Throws:
InjectionException- if an exception occurred while performing this task
-
execute
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:
trueif this requestor is valid,falseotherwise
-
disposed
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
Notifies the requestor that an object should be un-injected.- Parameters:
object- domain object that needs to be un-injectedobjectSupplier- the object supplier being un-injected- Returns:
trueif the object was uninjected,falseotherwise- Throws:
InjectionException- if an exception occurred while performing this task
-