A
- my qualifier annotation typeT
- my value typepublic abstract class ContextBasedObjectSupplier<A extends Annotation,T>
extends org.eclipse.e4.core.di.suppliers.ExtendedObjectSupplier
Modifier | Constructor and Description |
---|---|
protected |
ContextBasedObjectSupplier(Class<A> qualifierType,
Class<T> valueType)
Initializes me with the type of value that I supply and the
qualifier annotation type that I key on.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkDependencies(A qualifier,
Class<? extends T> requestedType,
org.eclipse.e4.core.contexts.IEclipseContext context)
Check whether the Eclipse
context has the dependencies required to
compute my result. |
protected abstract Optional<? extends T> |
compute(A qualifier,
Class<? extends T> requestedType,
org.eclipse.e4.core.contexts.IEclipseContext context)
Compute my value from the Eclipse
context . |
Object |
get(org.eclipse.e4.core.di.suppliers.IObjectDescriptor descriptor,
org.eclipse.e4.core.di.suppliers.IRequestor requestor,
boolean track,
boolean group) |
public Object get(org.eclipse.e4.core.di.suppliers.IObjectDescriptor descriptor, org.eclipse.e4.core.di.suppliers.IRequestor requestor, boolean track, boolean group)
get
in class org.eclipse.e4.core.di.suppliers.ExtendedObjectSupplier
protected boolean checkDependencies(A qualifier, Class<? extends T> requestedType, org.eclipse.e4.core.contexts.IEclipseContext context)
context
has the dependencies required to
compute my result. The default implementation just attempts to compute
the result, which is useful for simple cases where the computation is not
expensive and does not have undesired side-effects if it fails.qualifier
- the qualifier annotation, which may have attributes required for the computationrequestedType
- the type requested for injectioncontext
- the Eclipse contexttrue
if I can compute a value from this context
;
false
, otherwise#compute(Annotation, IEclipseContext)
protected abstract Optional<? extends T> compute(A qualifier, Class<? extends T> requestedType, org.eclipse.e4.core.contexts.IEclipseContext context)
context
. An empty result
indicates that the value does not exist (the IInjector.NOT_A_VALUE
special result for the object-supplier protocol). Injection of null
values is not supported.qualifier
- the qualifier annotation, which may have attributes required for the computationrequestedType
- the type requested for injectioncontext
- the Eclipse contextnull
)Copyright © 2019. All rights reserved.