Class Qualifiers
java.lang.Object
org.microbean.assign.Qualifiers
- All Implemented Interfaces:
Constable
A utility class for working with qualifiers.
This class is currently not used by other classes in this package. It may be useful in a variety of dependency injection systems.
- Author:
- Laird Nelson
-
Constructor Summary
ConstructorsConstructorDescriptionQualifiers(AnnotationMirror metaQualifier) Creates a newQualifiers.Qualifiers(AnnotationMirror metaQualifier, Predicate<? super ExecutableElement> annotationElementInclusionPredicate) Creates a newQualifiers.Qualifiers(Domain domain) Creates a newQualifiers.Qualifiers(Domain domain, AnnotationMirror metaQualifier, Predicate<? super ExecutableElement> annotationElementInclusionPredicate) Creates a newQualifiers. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleancontains(Collection<? extends AnnotationMirror> c, AnnotationMirror a) Returnstrueif and only if the suppliedCollectionofAnnotationMirrors contains anAnnotationMirrorthat is the same as the suppliedAnnotationMirror.final booleancontainsAll(Collection<? extends AnnotationMirror> c0, Collection<? extends AnnotationMirror> c1) Optional<? extends ConstantDesc> Returns a non-null, determinateOptionalhousing aConstantDescdescribing thisQualifiers, or an emptyOptionalif it cannot be described.final AnnotationMirrorReturns a non-null, determinateAnnotationMirrorthat can be used to designate (meta-annotate) other annotations as qualifiers.final booleanReturnstrueif and only if the suppliedAnnotationMirroris the same annotation as the suppliedAnnotationMirror.final List<AnnotationMirror> Returns a non-null, determinate, immutableListwhose sole element is the meta-qualifier annotation.final booleanReturnstrueif and only if the suppliedAnnotationMirrorhas an annotation type declared by aTypeElementthat is annotated with at least one annotation deemed to be the meta-qualifier.qualifiers(Collection<? extends AnnotationMirror> as) Returns a non-null, determinate, immutableListofAnnotationMirrorinstances drawn from the suppliedCollectionthat were deemed to be qualifiers.final booleansameAnnotation(AnnotationMirror am0, AnnotationMirror am1) Determines whether the twoAnnotationMirrors represent the same (underlying, otherwise opaque) annotation.
-
Constructor Details
-
Qualifiers
Creates a newQualifiers.- Parameters:
domain- a non-nullDomain- Throws:
NullPointerException- ifdomainisnull- See Also:
-
Qualifiers
Creates a newQualifiers.- Parameters:
metaQualifier- a non-nullAnnotationMirrorto serve as the meta-qualifier- Throws:
NullPointerException- ifmetaQualifierisnull- See Also:
-
Qualifiers
public Qualifiers(AnnotationMirror metaQualifier, Predicate<? super ExecutableElement> annotationElementInclusionPredicate) Creates a newQualifiers.- Parameters:
metaQualifier- a non-nullAnnotationMirrorto serve as the meta-qualifierannotationElementInclusionPredicate- aPredicatethat returnstrueif a givenExecutableElement, representing an annotation element, is to be included in the computation; may benullin which case it is as ife -> truewere supplied instead- Throws:
NullPointerException- ifmetaQualifierisnull- See Also:
-
Qualifiers
public Qualifiers(Domain domain, AnnotationMirror metaQualifier, Predicate<? super ExecutableElement> annotationElementInclusionPredicate) Creates a newQualifiers.- Parameters:
domain- aDomain; ifnull, thenmetaQualifiermust not benullmetaQualifier- anAnnotationMirrorto serve as the meta-qualifier; may (commonly) benullin which case a synthetic meta-qualifier will be used instead; must not benullifdomainisnullannotationElementInclusionPredicate- aPredicatethat returnstrueif a givenExecutableElement, representing an annotation element, is to be included in the computation; may benullin which case it is as ife -> truewere supplied instead- Throws:
NullPointerException- ifdomainisnullin certain situations
-
-
Method Details
-
contains
Returnstrueif and only if the suppliedCollectionofAnnotationMirrors contains anAnnotationMirrorthat is the same as the suppliedAnnotationMirror.- Parameters:
c- a non-nullCollectionofAnnotationMirrorsa- a non-nullAnnotationMirror- Returns:
trueif and only if the suppliedCollectionofAnnotationMirrors contains anAnnotationMirrorthat is the same as the suppliedAnnotationMirror- Throws:
NullPointerException- ifcoraisnull- See Also:
-
containsAll
public final boolean containsAll(Collection<? extends AnnotationMirror> c0, Collection<? extends AnnotationMirror> c1) - Parameters:
c0- a non-nullCollectionofAnnotationMirrorsc1- a non-nullCollectionofAnnotationMirrors- Returns:
trueif and only ifc0contains all the sameAnnotationMirrors as are found inc1- Throws:
NullPointerException- if eitherc0orc1isnull- See Also:
-
describeConstable
Returns a non-null, determinateOptionalhousing aConstantDescdescribing thisQualifiers, or an emptyOptionalif it cannot be described.- Specified by:
describeConstablein interfaceConstable- Returns:
- a non-
null, determinateOptionalhousing aConstantDescdescribing thisQualifiers, or an emptyOptionalif it cannot be described
-
metaQualifier
Returns a non-null, determinateAnnotationMirrorthat can be used to designate (meta-annotate) other annotations as qualifiers.- Returns:
- a non-
null, determinateAnnotationMirrorthat can be used to designate (meta-annotate) other annotations as qualifiers
-
metaQualifier
Returnstrueif and only if the suppliedAnnotationMirroris the same annotation as the suppliedAnnotationMirror.- Parameters:
a- a non-nullAnnotationMirror- Returns:
trueif and only if if and only if the suppliedAnnotationMirroris the same annotation as the suppliedAnnotationMirror- Throws:
NullPointerException- ifaisnull- See Also:
-
metaQualifiers
Returns a non-null, determinate, immutableListwhose sole element is the meta-qualifier annotation.- Returns:
- a non-
null, determinate, immutableListwhose sole element is the meta-qualifier annotation
-
qualifier
Returnstrueif and only if the suppliedAnnotationMirrorhas an annotation type declared by aTypeElementthat is annotated with at least one annotation deemed to be the meta-qualifier.- Parameters:
a- a non-nullAnnotationMirror- Returns:
trueif and only if the suppliedAnnotationMirrorhas an annotation type declared by aTypeElementthat is annotated with at least one annotation deemed to be the meta-qualifier- Throws:
NullPointerException- ifaisnull
-
qualifiers
Returns a non-null, determinate, immutableListofAnnotationMirrorinstances drawn from the suppliedCollectionthat were deemed to be qualifiers.- Parameters:
as- a non-nullCollectionofAnnotationMirrors- Returns:
- a non-
null, determinate, immutableListofAnnotationMirrorinstances drawn from the suppliedCollectionthat were deemed to be qualifiers - Throws:
NullPointerException- ifasisnull- See Also:
-
sameAnnotation
Determines whether the twoAnnotationMirrors represent the same (underlying, otherwise opaque) annotation.- Parameters:
am0- anAnnotationMirror; may benullam1- anAnnotationMirror; may benull- Returns:
trueif the suppliedAnnotationMirrors represent the same (underlying, otherwise opaque) annotation;falseotherwise- See Also:
-