Class Scoping
java.lang.Object
org.elasticsearch.common.inject.internal.Scoping
public abstract class Scoping
extends java.lang.Object
References a scope, either directly (as a scope instance), or indirectly (as a scope annotation).
The scope's eager or laziness is also exposed.
-
Field Summary
Fields Modifier and Type Field Description static ScopingEAGER_SINGLETONstatic ScopingSINGLETON_ANNOTATIONstatic ScopingSINGLETON_INSTANCEstatic ScopingUNSCOPEDNo scoping annotation has been applied. -
Method Summary
Modifier and Type Method Description abstract <V> VacceptVisitor(BindingScopingVisitor<V> visitor)abstract voidapplyTo(ScopedBindingBuilder scopedBindingBuilder)static ScopingforAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> scopingAnnotation)static ScopingforInstance(Scope scope)java.lang.Class<? extends java.lang.annotation.Annotation>getScopeAnnotation()Returns the scope annotation, ornullif that isn't known for this instance.ScopegetScopeInstance()Returns the scope instance, ornullif that isn't known for this instance.booleanisEagerSingleton(Stage stage)Returns true if this scope is a singleton that should be loaded eagerly instage.booleanisExplicitlyScoped()Returns true if this scope was explicitly applied.booleanisNoScope()Returns true if this is the default scope.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
UNSCOPED
No scoping annotation has been applied. Note that this is different fromin(Scopes.NO_SCOPE), where the 'NO_SCOPE' has been explicitly applied. -
SINGLETON_ANNOTATION
-
SINGLETON_INSTANCE
-
EAGER_SINGLETON
-
-
Method Details
-
forAnnotation
public static Scoping forAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> scopingAnnotation) -
forInstance
-
isExplicitlyScoped
public boolean isExplicitlyScoped()Returns true if this scope was explicitly applied. If no scope was explicitly applied then the scoping annotation will be used. -
isNoScope
public boolean isNoScope()Returns true if this is the default scope. In this case a new instance will be provided for each injection. -
isEagerSingleton
Returns true if this scope is a singleton that should be loaded eagerly instage. -
getScopeInstance
Returns the scope instance, ornullif that isn't known for this instance. -
getScopeAnnotation
public java.lang.Class<? extends java.lang.annotation.Annotation> getScopeAnnotation()Returns the scope annotation, ornullif that isn't known for this instance. -
acceptVisitor
-
applyTo
-