Package io.micronaut.core.annotation
Class AnnotationUtil
java.lang.Object
io.micronaut.core.annotation.AnnotationUtil
Internal utility methods for annotations. For Internal and framework use only. Do not use in application code.
- Since:
- 1.0
- Author:
- Graeme Rocher
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringThe adapter annotation type.static final StringThe around annotation type.static final StringThe around annotation type.static final StringThe inherited annotation.static final StringName of the interceptor binding type.static final StringName of the interceptor binding qualifier type.static final StringName of the repeatable interceptor bindings type.static final StringThe around annotation type.static final AnnotatedElementAn empty re-usable element.static final StringThe meta annotation used for inject declarations.static final StringConstant for Kotlin metadata.static final StringThe name of the required member.static final StringThe meta annotation used for named qualifiers.static final StringThe annotation attribute containing all the attributes marked as non-binding.static final StringSimple Annotation name used for non-null.static final StringSimple Annotation name used for nullable.static final StringThe meta annotation used for post-construct declarations.static final StringThe meta annotation used for pre-destroy declarations.static final StringThe meta annotation used for qualifier declarations.static final StringThe meta annotation used for scope declarations.static final StringThe meta annotation used for singleton scope.Packages excludes from stereotype processing.static final AnnotatedElement[]Constant indicating a zero annotation.static final AnnotationValue<?>[]Constant indicating a zero annotation values.static final Annotation[]Constant indicating a zero annotation.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic booleanComputes whether 2 annotation values are equal.static intcalculateHashCode(Map<? extends CharSequence, Object> values) Calculates the hash code of annotation values.findQualifierAnnotation(AnnotationMetadata annotationMetadata) Finds a qualifier annotation.static List<AnnotationValue<Annotation>>findQualifierAnnotations(AnnotationMetadata annotationMetadata) Finds qualifier annotations.findQualifierAnnotationsNames(AnnotationMetadata annotationMetadata) Finds qualifier annotations names.static booleanhasDeclaredQualifierAnnotation(AnnotationMetadata annotationMetadata) Has qualifier annotations.internListOf(Object... objects) Converts the given objects into a set of potentially cached and interned strings contained within an internal pool of lists.internMapOf(Object... values) Converts the given objects into a map of potentially cached and interned strings where the keys and values are alternating entries in the passed array.internMapOf(String key, Object value) Converts the given objects into a map of potentially cached and interned strings where the keys and values are alternating entries in the passed array.Create a new immutableMapfrom an array of values.Create a new immutableMap.Create a new immutableMap.Create a new immutableMap.mapOf(String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4) Create a new immutableMap.mapOf(String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4, String key5, Object value5) Create a new immutableMap.mapOf(String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4, String key5, Object value5, String key6, Object value6) Create a new immutableMap.mapOf(String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4, String key5, Object value5, String key6, Object value6, String key7, Object value7) Create a new immutableMap.mapOf(String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4, String key5, Object value5, String key6, Object value6, String key7, Object value7, String key8, Object value8) Create a new immutableMap.mapOf(String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4, String key5, Object value5, String key6, Object value6, String key7, Object value7, String key8, Object value8, String key9, Object value9) Create a new immutableMap.mapOf(String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4, String key5, Object value5, String key6, Object value6, String key7, Object value7, String key8, Object value8, String key9, Object value9, String key10, Object value10) Create a new immutableMap.static String[]resolveNonBindingMembers(AnnotationMetadata annotationMetadata) Resolve non-binding members.
- 
Field Details- 
KOTLIN_METADATAConstant for Kotlin metadata.- See Also:
 
- 
INTERNAL_ANNOTATION_NAMES
- 
STEREOTYPE_EXCLUDESPackages excludes from stereotype processing.
- 
ZERO_ANNOTATIONSConstant indicating a zero annotation.
- 
ZERO_ANNOTATED_ELEMENTSConstant indicating a zero annotation.
- 
ZERO_ANNOTATION_VALUESConstant indicating a zero annotation values.
- 
EMPTY_ANNOTATED_ELEMENTAn empty re-usable element.
- 
NULLABLESimple Annotation name used for nullable.- See Also:
 
- 
NON_NULLSimple Annotation name used for non-null.- See Also:
 
- 
ANN_AROUNDThe around annotation type.- See Also:
 
- 
ANN_AROUND_CONSTRUCTThe around annotation type.- See Also:
 
- 
ANN_INTRODUCTIONThe around annotation type.- See Also:
 
- 
ANN_ADAPTERThe adapter annotation type.- See Also:
 
- 
ANN_INTERCEPTOR_BINDINGName of the interceptor binding type.- See Also:
 
- 
ANN_INTERCEPTOR_BINDING_QUALIFIERName of the interceptor binding qualifier type.- See Also:
 
- 
ANN_INTERCEPTOR_BINDINGSName of the repeatable interceptor bindings type.- See Also:
 
- 
INJECTThe meta annotation used for inject declarations.- See Also:
 
- 
SCOPEThe meta annotation used for scope declarations.- See Also:
 
- 
SINGLETONThe meta annotation used for singleton scope.- See Also:
 
- 
QUALIFIERThe meta annotation used for qualifier declarations.- See Also:
 
- 
NAMEDThe meta annotation used for named qualifiers.- See Also:
 
- 
PRE_DESTROYThe meta annotation used for pre-destroy declarations.- See Also:
 
- 
POST_CONSTRUCTThe meta annotation used for post-construct declarations.- See Also:
 
- 
NON_BINDING_ATTRIBUTEThe annotation attribute containing all the attributes marked as non-binding.- See Also:
 
- 
ANN_INHERITEDThe inherited annotation.
- 
MEMBER_REQUIREDThe name of the required member.- See Also:
 
 
- 
- 
Constructor Details- 
AnnotationUtilpublic AnnotationUtil()
 
- 
- 
Method Details- 
findQualifierAnnotationspublic static List<AnnotationValue<Annotation>> findQualifierAnnotations(AnnotationMetadata annotationMetadata) Finds qualifier annotations.- Parameters:
- annotationMetadata- The annotation metadata
- Returns:
- The qualifier annotations
- Since:
- 4.0.0
 
- 
findQualifierAnnotationsNamesFinds qualifier annotations names.- Parameters:
- annotationMetadata- The annotation metadata
- Returns:
- The qualifier annotations names
- Since:
- 4.0.0
 
- 
hasDeclaredQualifierAnnotationHas qualifier annotations.- Parameters:
- annotationMetadata- The annotation metadata
- Returns:
- True if qualifier annotation
- Since:
- 4.0.0
 
- 
resolveNonBindingMembersResolve non-binding members.- Parameters:
- annotationMetadata- The annotation metadata
- Returns:
- The non-binding members
- Since:
- 4.0.0
 
- 
findQualifierAnnotationFinds a qualifier annotation.- Parameters:
- annotationMetadata- The annotation metadata
- Returns:
- A qualifier annotation
- Since:
- 4.0.0
 
- 
internListOfConverts the given objects into a set of potentially cached and interned strings contained within an internal pool of lists. SeeString.intern().This method serves the purpose of reducing memory footprint by pooling common lists of annotations in compiled AnnotationMetadata- Parameters:
- objects- The objects
- Returns:
- Immutable, pooled set of strings
 
- 
internMapOfConverts the given objects into a map of potentially cached and interned strings where the keys and values are alternating entries in the passed array. SeeString.intern().The values stored at even number positions will be converted to strings and interned. - Parameters:
- values- The objects
- Returns:
- An unmodifiable set of strings
- See Also:
 
- 
internMapOfConverts the given objects into a map of potentially cached and interned strings where the keys and values are alternating entries in the passed array. SeeString.intern().The values stored at even number positions will be converted to strings and interned. - Parameters:
- key- The key
- value- The value
- Returns:
- An unmodifiable set of strings
- Since:
- 3.0
 
- 
mapOfCreate a new immutableMapfrom an array of values. String values must be sorted!- Parameters:
- array- The key, value array
- Returns:
- The created map
 
- 
mapOfCreate a new immutableMap. String values must be sorted!- Parameters:
- key1- The key 1
- value1- The value 1
- Returns:
- The created map
 
- 
mapOfCreate a new immutableMap. String values must be sorted!- Parameters:
- key1- The key1
- value1- The value1
- key2- The key2
- value2- The value2
- Returns:
- The created map
 
- 
mapOfpublic static Map<String,Object> mapOf(String key1, Object value1, String key2, Object value2, String key3, Object value3) Create a new immutableMap. String values must be sorted!- Parameters:
- key1- The key1
- value1- The value1
- key2- The key2
- value2- The value2
- key3- The key3
- value3- The value3
- Returns:
- The created map
 
- 
mapOfpublic static Map<String,Object> mapOf(String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4) Create a new immutableMap. String values must be sorted!- Parameters:
- key1- The key1
- value1- The value1
- key2- The key2
- value2- The value2
- key3- The key3
- value3- The value3
- key4- The key4
- value4- The value4
- Returns:
- The created map
 
- 
mapOfpublic static Map<String,Object> mapOf(String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4, String key5, Object value5) Create a new immutableMap. String values must be sorted!- Parameters:
- key1- The key1
- value1- The value1
- key2- The key2
- value2- The value2
- key3- The key3
- value3- The value3
- key4- The key4
- value4- The value4
- key5- The key5
- value5- The value5
- Returns:
- The created map
 
- 
mapOfpublic static Map<String,Object> mapOf(String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4, String key5, Object value5, String key6, Object value6) Create a new immutableMap. String values must be sorted!- Parameters:
- key1- The key1
- value1- The value1
- key2- The key2
- value2- The value2
- key3- The key3
- value3- The value3
- key4- The key4
- value4- The value4
- key5- The key5
- value5- The value5
- key6- The key6
- value6- The value6
- Returns:
- The created map
 
- 
mapOfpublic static Map<String,Object> mapOf(String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4, String key5, Object value5, String key6, Object value6, String key7, Object value7) Create a new immutableMap. String values must be sorted!- Parameters:
- key1- The key1
- value1- The value1
- key2- The key2
- value2- The value2
- key3- The key3
- value3- The value3
- key4- The key4
- value4- The value4
- key5- The key5
- value5- The value5
- key6- The key6
- value6- The value6
- key7- The key7
- value7- The value7
- Returns:
- The created map
 
- 
mapOfpublic static Map<String,Object> mapOf(String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4, String key5, Object value5, String key6, Object value6, String key7, Object value7, String key8, Object value8) Create a new immutableMap. String values must be sorted!- Parameters:
- key1- The key1
- value1- The value1
- key2- The key2
- value2- The value2
- key3- The key3
- value3- The value3
- key4- The key4
- value4- The value4
- key5- The key5
- value5- The value5
- key6- The key6
- value6- The value6
- key7- The key7
- value7- The value7
- key8- The key8
- value8- The value8
- Returns:
- The created map
 
- 
mapOfpublic static Map<String,Object> mapOf(String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4, String key5, Object value5, String key6, Object value6, String key7, Object value7, String key8, Object value8, String key9, Object value9) Create a new immutableMap. String values must be sorted!- Parameters:
- key1- The key1
- value1- The value1
- key2- The key2
- value2- The value2
- key3- The key3
- value3- The value3
- key4- The key4
- value4- The value4
- key5- The key5
- value5- The value5
- key6- The key6
- value6- The value6
- key7- The key7
- value7- The value7
- key8- The key8
- value8- The value8
- key9- The key9
- value9- The value9
- Returns:
- The created map
 
- 
mapOfpublic static Map<String,Object> mapOf(String key1, Object value1, String key2, Object value2, String key3, Object value3, String key4, Object value4, String key5, Object value5, String key6, Object value6, String key7, Object value7, String key8, Object value8, String key9, Object value9, String key10, Object value10) Create a new immutableMap. String values must be sorted!- Parameters:
- key1- The key1
- value1- The value1
- key2- The key2
- value2- The value2
- key3- The key3
- value3- The value3
- key4- The key4
- value4- The value4
- key5- The key5
- value5- The value5
- key6- The key6
- value6- The value6
- key7- The key7
- value7- The value7
- key8- The key8
- value8- The value8
- key9- The key9
- value9- The value9
- key10- The key10
- value10- The value10
- Returns:
- The created map
 
- 
calculateHashCodeCalculates the hash code of annotation values.- Parameters:
- values- The map to calculate values' hash code
- Returns:
- The hash code
 
- 
areEqualComputes whether 2 annotation values are equal.- Parameters:
- o1- One object
- o2- Another object
- Returns:
- Whether both objects are equal
 
 
-