Package org.int4.dirk.spi.config
Interface ScopeStrategy
-
public interface ScopeStrategyDefines the strategy for scope handling.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.annotation.AnnotationgetDefaultAnnotation()Returns the annotation that marks the default scope.java.lang.annotation.AnnotationgetDependentAnnotation()Returns the annotation that marks the dependent pseudo-scope.java.lang.annotation.AnnotationgetScope(java.lang.reflect.AnnotatedElement element)Returns the scope annotation on the givenAnnotatedElement, if any.java.lang.annotation.AnnotationgetSingletonAnnotation()Returns the annotation that marks the singleton pseudo-scope.booleanisPseudoScope(java.lang.annotation.Annotation annotation)Returns whether the given annotation is a pseudo-scope.
-
-
-
Method Detail
-
getDefaultAnnotation
java.lang.annotation.Annotation getDefaultAnnotation()
Returns the annotation that marks the default scope. Objects without a scope annotation will get this scope as their scope.- Returns:
- an annotation, never
null
-
getDependentAnnotation
java.lang.annotation.Annotation getDependentAnnotation()
Returns the annotation that marks the dependent pseudo-scope.- Returns:
- an annotation, never
null
-
getSingletonAnnotation
java.lang.annotation.Annotation getSingletonAnnotation()
Returns the annotation that marks the singleton pseudo-scope.- Returns:
- an annotation, never
null
-
getScope
java.lang.annotation.Annotation getScope(java.lang.reflect.AnnotatedElement element) throws DefinitionExceptionReturns the scope annotation on the givenAnnotatedElement, if any. It is recommended to returnnullinstead of a default scope annotation if no scope is found on the given element.- Parameters:
element- anAnnotatedElement, cannot benull- Returns:
- an annotation, or
nullif the element was not annotated with a scope annotation - Throws:
DefinitionException- when the strategy detects an annotation problem
-
isPseudoScope
boolean isPseudoScope(java.lang.annotation.Annotation annotation)
Returns whether the given annotation is a pseudo-scope.- Parameters:
annotation- anAnnotation, cannot benull- Returns:
trueif the givenAnnotationis a pseudo-scope, otherwisefalse- Throws:
java.lang.IllegalArgumentException- if the given annotation is not a scope annotation
-
-