Class ViewServiceSupplier
- java.lang.Object
-
- org.eclipse.e4.core.di.suppliers.ExtendedObjectSupplier
-
- org.eclipse.emf.ecp.view.spi.common.di.ContextBasedObjectSupplier<ViewService,java.lang.Object>
-
- org.eclipse.emf.ecp.view.model.common.di.service.impl.ViewServiceSupplier
-
public class ViewServiceSupplier extends ContextBasedObjectSupplier<ViewService,java.lang.Object>
Eclipse DI supplier of the view-model service dependency. Resolvable only in a context that has aViewModelContext
available.- See Also:
ViewService
-
-
Constructor Summary
Constructors Constructor Description ViewServiceSupplier()
Initializes me.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
checkDependencies(ViewService qualifier, java.lang.Class<?> requestedType, org.eclipse.e4.core.contexts.IEclipseContext context)
Check whether the Eclipsecontext
has the dependencies required to compute my result.protected java.util.Optional<?>
compute(ViewService qualifier, java.lang.Class<?> requestedType, org.eclipse.e4.core.contexts.IEclipseContext context)
Compute my value from the Eclipsecontext
.-
Methods inherited from class org.eclipse.emf.ecp.view.spi.common.di.ContextBasedObjectSupplier
get
-
-
-
-
Method Detail
-
checkDependencies
protected boolean checkDependencies(ViewService qualifier, java.lang.Class<?> requestedType, org.eclipse.e4.core.contexts.IEclipseContext context)
Description copied from class:ContextBasedObjectSupplier
Check whether the Eclipsecontext
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.- Overrides:
checkDependencies
in classContextBasedObjectSupplier<ViewService,java.lang.Object>
- Parameters:
qualifier
- the qualifier annotation, which may have attributes required for the computationrequestedType
- the type requested for injectioncontext
- the Eclipse context- Returns:
true
if I can compute a value from thiscontext
;false
, otherwise- See Also:
#compute(Annotation, IEclipseContext)
-
compute
protected java.util.Optional<?> compute(ViewService qualifier, java.lang.Class<?> requestedType, org.eclipse.e4.core.contexts.IEclipseContext context)
Description copied from class:ContextBasedObjectSupplier
Compute my value from the Eclipsecontext
. An empty result indicates that the value does not exist (theIInjector.NOT_A_VALUE
special result for the object-supplier protocol). Injection ofnull
values is not supported.- Specified by:
compute
in classContextBasedObjectSupplier<ViewService,java.lang.Object>
- Parameters:
qualifier
- the qualifier annotation, which may have attributes required for the computationrequestedType
- the type requested for injectioncontext
- the Eclipse context- Returns:
- the result of the computation (possibly empty, but not
null
)
-
-