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 Summary
Modifier and TypeFieldDescriptionstatic final String
The around annotation type.static final String
The around annotation type.static final String
The inherited annotation.static final String
Name of the interceptor binding type.static final String
Name of the interceptor binding qualifier type.static final String
Name of the repeatable interceptor bindings type.static final String
The around annotation type.static final AnnotatedElement
An empty re-usable element.static final String
The meta annotation used for inject declarations.static final String
Constant for Kotlin metadata.static final String
The meta annotation used for named qualifiers.static final String
The annotation attribute containing all the attributes marked as non-binding.static final String
Simple Annotation name used for non-null.static final String
Simple Annotation name used for nullable.static final String
The meta annotation used for post-construct declarations.static final String
The meta annotation used for pre-destroy declarations.static final String
The meta annotation used for qualifier declarations.static final String
The meta annotation used for scope declarations.static final String
The 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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Computes whether 2 annotation values are equal.static int
calculateHashCode
(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 boolean
hasDeclaredQualifierAnnotation
(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 immutableMap
from 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_METADATA
Constant for Kotlin metadata.- See Also:
-
INTERNAL_ANNOTATION_NAMES
-
STEREOTYPE_EXCLUDES
Packages excludes from stereotype processing. -
ZERO_ANNOTATIONS
Constant indicating a zero annotation. -
ZERO_ANNOTATED_ELEMENTS
Constant indicating a zero annotation. -
ZERO_ANNOTATION_VALUES
Constant indicating a zero annotation values. -
EMPTY_ANNOTATED_ELEMENT
An empty re-usable element. -
NULLABLE
Simple Annotation name used for nullable.- See Also:
-
NON_NULL
Simple Annotation name used for non-null.- See Also:
-
ANN_AROUND
The around annotation type.- See Also:
-
ANN_AROUND_CONSTRUCT
The around annotation type.- See Also:
-
ANN_INTRODUCTION
The around annotation type.- See Also:
-
ANN_INTERCEPTOR_BINDING
Name of the interceptor binding type.- See Also:
-
ANN_INTERCEPTOR_BINDING_QUALIFIER
Name of the interceptor binding qualifier type.- See Also:
-
ANN_INTERCEPTOR_BINDINGS
Name of the repeatable interceptor bindings type.- See Also:
-
INJECT
The meta annotation used for inject declarations.- See Also:
-
SCOPE
The meta annotation used for scope declarations.- See Also:
-
SINGLETON
The meta annotation used for singleton scope.- See Also:
-
QUALIFIER
The meta annotation used for qualifier declarations.- See Also:
-
NAMED
The meta annotation used for named qualifiers.- See Also:
-
PRE_DESTROY
The meta annotation used for pre-destroy declarations.- See Also:
-
POST_CONSTRUCT
The meta annotation used for post-construct declarations.- See Also:
-
NON_BINDING_ATTRIBUTE
The annotation attribute containing all the attributes marked as non-binding.- See Also:
-
ANN_INHERITED
The inherited annotation.
-
-
Constructor Details
-
AnnotationUtil
public AnnotationUtil()
-
-
Method Details
-
findQualifierAnnotations
public static List<AnnotationValue<Annotation>> findQualifierAnnotations(AnnotationMetadata annotationMetadata) Finds qualifier annotations.- Parameters:
annotationMetadata
- The annotation metadata- Returns:
- The qualifier annotations
- Since:
- 4.0.0
-
findQualifierAnnotationsNames
Finds qualifier annotations names.- Parameters:
annotationMetadata
- The annotation metadata- Returns:
- The qualifier annotations names
- Since:
- 4.0.0
-
hasDeclaredQualifierAnnotation
Has qualifier annotations.- Parameters:
annotationMetadata
- The annotation metadata- Returns:
- True if qualifier annotation
- Since:
- 4.0.0
-
resolveNonBindingMembers
Resolve non-binding members.- Parameters:
annotationMetadata
- The annotation metadata- Returns:
- The non-binding members
- Since:
- 4.0.0
-
findQualifierAnnotation
Finds a qualifier annotation.- Parameters:
annotationMetadata
- The annotation metadata- Returns:
- A qualifier annotation
- Since:
- 4.0.0
-
internListOf
Converts 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
-
internMapOf
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. 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:
-
internMapOf
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. SeeString.intern()
.The values stored at even number positions will be converted to strings and interned.
- Parameters:
key
- The keyvalue
- The value- Returns:
- An unmodifiable set of strings
- Since:
- 3.0
-
mapOf
Create a new immutableMap
from an array of values. String values must be sorted!- Parameters:
array
- The key, value array- Returns:
- The created map
-
mapOf
Create a new immutableMap
. String values must be sorted!- Parameters:
key1
- The key 1value1
- The value 1- Returns:
- The created map
-
mapOf
Create a new immutableMap
. String values must be sorted!- Parameters:
key1
- The key1value1
- The value1key2
- The key2value2
- The value2- Returns:
- The created map
-
mapOf
public 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 key1value1
- The value1key2
- The key2value2
- The value2key3
- The key3value3
- The value3- Returns:
- The created map
-
mapOf
public 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 key1value1
- The value1key2
- The key2value2
- The value2key3
- The key3value3
- The value3key4
- The key4value4
- The value4- Returns:
- The created map
-
mapOf
public 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 key1value1
- The value1key2
- The key2value2
- The value2key3
- The key3value3
- The value3key4
- The key4value4
- The value4key5
- The key5value5
- The value5- Returns:
- The created map
-
mapOf
public 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 key1value1
- The value1key2
- The key2value2
- The value2key3
- The key3value3
- The value3key4
- The key4value4
- The value4key5
- The key5value5
- The value5key6
- The key6value6
- The value6- Returns:
- The created map
-
mapOf
public 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 key1value1
- The value1key2
- The key2value2
- The value2key3
- The key3value3
- The value3key4
- The key4value4
- The value4key5
- The key5value5
- The value5key6
- The key6value6
- The value6key7
- The key7value7
- The value7- Returns:
- The created map
-
mapOf
public 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 key1value1
- The value1key2
- The key2value2
- The value2key3
- The key3value3
- The value3key4
- The key4value4
- The value4key5
- The key5value5
- The value5key6
- The key6value6
- The value6key7
- The key7value7
- The value7key8
- The key8value8
- The value8- Returns:
- The created map
-
mapOf
public 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 key1value1
- The value1key2
- The key2value2
- The value2key3
- The key3value3
- The value3key4
- The key4value4
- The value4key5
- The key5value5
- The value5key6
- The key6value6
- The value6key7
- The key7value7
- The value7key8
- The key8value8
- The value8key9
- The key9value9
- The value9- Returns:
- The created map
-
mapOf
public 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 key1value1
- The value1key2
- The key2value2
- The value2key3
- The key3value3
- The value3key4
- The key4value4
- The value4key5
- The key5value5
- The value5key6
- The key6value6
- The value6key7
- The key7value7
- The value7key8
- The key8value8
- The value8key9
- The key9value9
- The value9key10
- The key10value10
- The value10- Returns:
- The created map
-
calculateHashCode
Calculates the hash code of annotation values.- Parameters:
values
- The map to calculate values' hash code- Returns:
- The hash code
-
areEqual
Computes whether 2 annotation values are equal.- Parameters:
o1
- One objecto2
- Another object- Returns:
- Whether both objects are equal
-