Package com.google.inject.internal
Class Scoping
- java.lang.Object
-
- com.google.inject.internal.Scoping
-
public abstract class Scoping extends 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.- Author:
- jessewilson@google.com (Jesse Wilson)
-
-
Field Summary
Fields Modifier and Type Field Description static Scoping
EAGER_SINGLETON
static Scoping
SINGLETON_ANNOTATION
static Scoping
SINGLETON_INSTANCE
static Scoping
UNSCOPED
No scoping annotation has been applied.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract <V> V
acceptVisitor(BindingScopingVisitor<V> visitor)
abstract void
applyTo(ScopedBindingBuilder scopedBindingBuilder)
boolean
equals(Object obj)
static Scoping
forAnnotation(Class<? extends Annotation> scopingAnnotation)
static Scoping
forInstance(Scope scope)
Class<? extends Annotation>
getScopeAnnotation()
Returns the scope annotation, ornull
if that isn't known for this instance.Scope
getScopeInstance()
Returns the scope instance, ornull
if that isn't known for this instance.int
hashCode()
boolean
isEagerSingleton(Stage stage)
Returns true if this scope is a singleton that should be loaded eagerly instage
.boolean
isExplicitlyScoped()
Returns true if this scope was explicitly applied.boolean
isNoScope()
Returns true if this is the default scope.
-
-
-
Field Detail
-
UNSCOPED
public static final Scoping 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
public static final Scoping SINGLETON_ANNOTATION
-
SINGLETON_INSTANCE
public static final Scoping SINGLETON_INSTANCE
-
EAGER_SINGLETON
public static final Scoping EAGER_SINGLETON
-
-
Method Detail
-
forAnnotation
public static Scoping forAnnotation(Class<? extends Annotation> scopingAnnotation)
-
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
public boolean isEagerSingleton(Stage stage)
Returns true if this scope is a singleton that should be loaded eagerly instage
.
-
getScopeInstance
public Scope getScopeInstance()
Returns the scope instance, ornull
if that isn't known for this instance.
-
getScopeAnnotation
public Class<? extends Annotation> getScopeAnnotation()
Returns the scope annotation, ornull
if that isn't known for this instance.
-
acceptVisitor
public abstract <V> V acceptVisitor(BindingScopingVisitor<V> visitor)
-
applyTo
public abstract void applyTo(ScopedBindingBuilder scopedBindingBuilder)
-
-