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 CreationalContext<?>find(java.lang.Object key)Find an existingCreationalContextby key in the current active scope, or returnnullif no context was found in the given scope with the given key.java.lang.annotation.AnnotationgetAnnotation()Returns the annotation this resolver handles.booleanisActive()Returnstruewhen this scope is currently active, otherwisefalse.voidput(java.lang.Object key, CreationalContext<?> creationalContext)Adds aCreationalContextto this scope resolver under the given key.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
-
find
CreationalContext<?> find(java.lang.Object key) throws ScopeNotActiveException
Find an existingCreationalContextby key in the current active scope, or returnnullif no context was found in the given scope with the given key.- Parameters:
key- an object suitable as a key for use in a map, cannot benull- Returns:
- a
CreationalContextif found, otherwisenull - Throws:
ScopeNotActiveException- when there is no scope active
-
put
void put(java.lang.Object key, CreationalContext<?> creationalContext) throws ScopeNotActiveExceptionAdds aCreationalContextto this scope resolver under the given key.- Parameters:
key- an object suitable as a key for use in a map, cannot benullcreationalContext- aCreationalContext, cannot benull- Throws:
ScopeNotActiveException- when there is no scope active
-
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
-
-