public abstract class Scoping
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static Scoping |
EAGER_SINGLETON |
static Scoping |
SINGLETON_ANNOTATION |
static Scoping |
SINGLETON_INSTANCE |
static Scoping |
UNSCOPED
No scoping annotation has been applied.
|
Modifier | Constructor and Description |
---|---|
private |
Scoping() |
Modifier and Type | Method and Description |
---|---|
abstract <V> V |
acceptVisitor(BindingScopingVisitor<V> visitor) |
abstract void |
applyTo(ScopedBindingBuilder scopedBindingBuilder) |
boolean |
equals(java.lang.Object obj) |
static Scoping |
forAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> scopingAnnotation) |
static Scoping |
forInstance(Scope scope) |
java.lang.Class<? extends java.lang.annotation.Annotation> |
getScopeAnnotation()
Returns the scope annotation, or
null if that isn't known for this instance. |
Scope |
getScopeInstance()
Returns the scope instance, or
null 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 in
stage . |
boolean |
isExplicitlyScoped()
Returns true if this scope was explicitly applied.
|
boolean |
isNoScope()
Returns true if this is the default scope.
|
(package private) static Scoping |
makeInjectable(Scoping scoping,
InjectorImpl injector,
Errors errors)
Replaces annotation scopes with instance scopes using the Injector's annotation-to-instance
map.
|
(package private) static <T> InternalFactory<? extends T> |
scope(Key<T> key,
InjectorImpl injector,
InternalFactory<? extends T> creator,
java.lang.Object source,
Scoping scoping)
Scopes an internal factory.
|
public static final Scoping UNSCOPED
in(Scopes.NO_SCOPE)
, where the 'NO_SCOPE' has been explicitly applied.public static final Scoping SINGLETON_ANNOTATION
public static final Scoping SINGLETON_INSTANCE
public static final Scoping EAGER_SINGLETON
public static Scoping forAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> scopingAnnotation)
public boolean isExplicitlyScoped()
public boolean isNoScope()
public boolean isEagerSingleton(Stage stage)
stage
.public Scope getScopeInstance()
null
if that isn't known for this instance.public java.lang.Class<? extends java.lang.annotation.Annotation> getScopeAnnotation()
null
if that isn't known for this instance.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public abstract <V> V acceptVisitor(BindingScopingVisitor<V> visitor)
public abstract void applyTo(ScopedBindingBuilder scopedBindingBuilder)
static <T> InternalFactory<? extends T> scope(Key<T> key, InjectorImpl injector, InternalFactory<? extends T> creator, java.lang.Object source, Scoping scoping)
static Scoping makeInjectable(Scoping scoping, InjectorImpl injector, Errors errors)