Package org.int4.dirk.spi.scope
Interface ScopeResolver
-
- All Known Implementing Classes:
AbstractScopeResolver,ExtendedScopeResolver,SingletonScopeResolver
public interface ScopeResolverHandles resolving of types with a specific scope annotation.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> Tget(java.lang.Object key, CreationalContext<T> creationalContext)Returns an existing instance associated with the given key, or uses the given context to create one.java.lang.annotation.AnnotationgetAnnotation()Returns the annotation this resolver handles.booleanisActive()Returnstruewhen this scope is currently active, otherwisefalse.voidremove(java.lang.Object key)Removes the given key from this scope resolver.
-
-
-
Method Detail
-
getAnnotation
java.lang.annotation.Annotation getAnnotation()
Returns the annotation this resolver handles. Returnsnullwhen the handler handles unscoped injectables.- Returns:
- the annotation this resolver handles, never
null
-
isActive
boolean isActive()
Returnstruewhen this scope is currently active, otherwisefalse.- Returns:
truewhen this scope is currently active, otherwisefalse
-
get
<T> T get(java.lang.Object key, CreationalContext<T> creationalContext) throws ScopeNotActiveException, java.lang.ExceptionReturns an existing instance associated with the given key, or uses the given context to create one.- Type Parameters:
T- the type of the instances provided by theCreationalContext- Parameters:
key- an object suitable as a key for use in a map, cannot benullcreationalContext- anCreationalContext, cannot benull- Returns:
- an instance of the given type, never
null - Throws:
ScopeNotActiveException- when there is no scope activejava.lang.Exception- when the object factory throws an exception
-
remove
void remove(java.lang.Object key)
Removes the given key from this scope resolver.- Parameters:
key- an object suitable as a key for use in a map, cannot benull
-
-