- All Superinterfaces:
Comparable<Annotation>
,Prototype.Api
- All Known Subinterfaces:
Qualifier
,io.helidon.service.registry.QualifierBlueprint
- All Known Implementing Classes:
Annotation.BuilderBase.AnnotationImpl
,Qualifier.BuilderBase.QualifierImpl
An annotation with defined values.
Annotations can have the following values:
- String -
@TheAnnotation("some-value")
- int -
@TheAnnotation(49)
- long -
@TheAnnotation(49L)
- boolean -
@TheAnnotation(true)
- byte -
@TheAnnotation(49)
- char -
@TheAnnotation('x')
- short -
@TheAnnotation(1)
- float -
@TheAnnotation(4.2f)
- double -
@TheAnnotation(4.2)
- enum value -
@TheAnnotation(MyEnum.OPTION_1)
, default representation is String - Class -
@TheAnnotation(MyType.class)
, default representation is String - another annotation -
@TheAnnotation(@TheOtherAnnotation("some-value"))
- arrays of the above -
@TheAnnotation({"first-value", "second-value"})
, represented as List
- Any type except for another annotation and array is available as String (similar for arrays)
- primitive types - only available as boxed types
- Class - use string, the method that provides class instances uses
Class.forName(String)
, which is not ideal, and may require additional configuration in native image - enum value - available as a String or enum value
- another annotation - available as instance(s) of Annotation
- arrays - available as a
List
of values
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
Fluent API builder forAnnotation
.static class
Annotation.BuilderBase<BUILDER extends Annotation.BuilderBase<BUILDER,
PROTOTYPE>, PROTOTYPE extends Annotation> Fluent API builder base forAnnotation
. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault Optional
<Annotation> Typed value of the property "value
".default Optional
<Annotation> annotationValue
(String property) Typed value of a named property.default Optional
<List<Annotation>> Typed value of the property "value
" that is defined as an array.default Optional
<List<Annotation>> annotationValues
(String property) Typed values of a property that is defined as an array.Typed value of the property "value
".booleanValue
(String property) Typed value of a named property.Typed value of the property "value
" that is defined as an array.booleanValues
(String property) Typed values of a property that is defined as an array.static Annotation.Builder
builder()
Create a new fluent API builder to customize configuration.static Annotation.Builder
builder
(Annotation instance) Create a new fluent API builder from an existing instance.Typed value of the property "value
".Typed value of a named property.Typed value of the property "value
" that is defined as an array.byteValues
(String property) Typed values of a property that is defined as an array.Typed value of the property "value
".Typed value of a named property.Typed value of the property "value
" that is defined as an array.charValues
(String property) Typed values of a property that is defined as an array.Typed value of the property "value
".classValue
(String property) Typed value of a named property.Typed value of the property "value
" that is defined as an array.classValues
(String property) Typed values of a property that is defined as an array.static Annotation
Creates an instance for an annotation with no value.static Annotation
Creates an instance for an annotation with a value.static Annotation
Creates an instance for annotation with zero or more values.static Annotation
create
(Class<? extends Annotation> annoType) Creates an instance for an annotation with no value.static Annotation
create
(Class<? extends Annotation> annoType, String value) Creates an instance for an annotation with a value.static Annotation
create
(Class<? extends Annotation> annoType, Map<String, ?> values) Creates an instance for an annotation with a value.Typed value of the property "value
".doubleValue
(String property) Typed value of a named property.Typed value of the property "value
" that is defined as an array.doubleValues
(String property) Typed values of a property that is defined as an array.Typed value of the property "value
".Typed value of a named property.enumValues
(Class<T> type) Typed value of the property "value
" that is defined as an array.enumValues
(String property, Class<T> type) Typed values of a property that is defined as an array.Typed value of the property "value
".floatValue
(String property) Typed value of a named property.Typed value of the property "value
" that is defined as an array.floatValues
(String property) Typed values of a property that is defined as an array.Get a value of an annotation property.default boolean
hasMetaAnnotation
(TypeName annotationType) Check ifAnnotationBlueprint.metaAnnotations()
contains an annotation of the provided type.intValue()
Typed value of the property "value
".Typed value of a named property.Typed value of the property "value
" that is defined as an array.Typed values of a property that is defined as an array.Typed value of the property "value
".Typed value of a named property.Typed value of the property "value
" that is defined as an array.longValues
(String property) Typed values of a property that is defined as an array.A list of inherited annotations (from the whole hierarchy).Value of the annotation as an object.objectValue
(String property) Value of the annotation property as an object.Typed value of the property "value
".shortValue
(String property) Typed value of a named property.Typed value of the property "value
" that is defined as an array.shortValues
(String property) Typed values of a property that is defined as an array.Typed value of the property "value
".stringValue
(String property) Typed value of a named property.Typed value of the property "value
" that is defined as an array.stringValues
(String property) Typed values of a property that is defined as an array.typeName()
The type name, e.g.,Objects
-> "java.util.Objects".Typed value of the property "value
".Typed value of a named property.Typed value of the property "value
" that is defined as an array.typeValues
(String property) Typed values of a property that is defined as an array.value()
The value property.values()
Get a key-value of all the annotation properties.Methods inherited from interface java.lang.Comparable
compareTo
-
Field Details
-
VALUE_PROPERTY
The "value
" property name.- See Also:
-
-
Method Details
-
builder
Create a new fluent API builder to customize configuration.- Returns:
- a new builder
-
builder
Create a new fluent API builder from an existing instance.- Parameters:
instance
- an existing instance used as a base for the builder- Returns:
- a builder based on an instance
-
create
Creates an instance for an annotation with no value.- Parameters:
annoType
- the annotation type- Returns:
- the new instance
-
create
Creates an instance for an annotation with no value.- Parameters:
annoType
- the annotation type- Returns:
- the new instance
-
create
Creates an instance for an annotation with a value.- Parameters:
annoType
- the annotation typevalue
- the annotation value- Returns:
- the new instance
-
create
Creates an instance for an annotation with a value.- Parameters:
annoType
- the annotation typevalues
- the annotation values- Returns:
- the new instance
-
create
Creates an instance for an annotation with a value.- Parameters:
annoTypeName
- the annotation type namevalue
- the annotation value- Returns:
- the new instance
-
create
Creates an instance for annotation with zero or more values.- Parameters:
annoTypeName
- the annotation type namevalues
- the annotation values- Returns:
- the new instance
-
typeName
TypeName typeName()The type name, e.g.,Objects
-> "java.util.Objects".- Returns:
- the annotation type name
-
values
Get a key-value of all the annotation properties.- Returns:
- key-value pairs of all the properties present
-
metaAnnotations
List<Annotation> metaAnnotations()A list of inherited annotations (from the whole hierarchy).- Returns:
- list of all annotations declared on the annotation type, or inherited from them
-
value
The value property.- Returns:
- the string value of value property
-
getValue
Get a value of an annotation property.- Parameters:
property
- name of the annotation property- Returns:
- string value of the property
-
objectValue
Value of the annotation as an object. The type can be either String, or any primitive type, orAnnotation
, or list of these.- Returns:
- object value
-
objectValue
Value of the annotation property as an object. The type can be either String, or any primitive type, orAnnotation
, or list of these.- Parameters:
property
- name of the annotation property- Returns:
- object value
-
stringValue
Typed value of the property "value
".- Returns:
- value if present
-
stringValue
Typed value of a named property.- Parameters:
property
- name of the annotation property- Returns:
- value if present
-
stringValues
Typed value of the property "value
" that is defined as an array. This will also work for a single values property.- Returns:
- list of defined values if present
-
stringValues
Typed values of a property that is defined as an array. This will also work for a single values property.- Parameters:
property
- name of the annotation property- Returns:
- list of defined values if present
-
intValue
Typed value of the property "value
".- Returns:
- value if present
-
intValue
Typed value of a named property.- Parameters:
property
- name of the annotation property- Returns:
- value if present
-
intValues
Typed value of the property "value
" that is defined as an array. This will also work for a single values property.- Returns:
- list of defined values if present
-
intValues
Typed values of a property that is defined as an array. This will also work for a single values property.- Parameters:
property
- name of the annotation property- Returns:
- list of defined values if present
-
longValue
Typed value of the property "value
".- Returns:
- value if present
-
longValue
Typed value of a named property.- Parameters:
property
- name of the annotation property- Returns:
- value if present
-
longValues
Typed value of the property "value
" that is defined as an array. This will also work for a single values property.- Returns:
- list of defined values if present
-
longValues
Typed values of a property that is defined as an array. This will also work for a single values property.- Parameters:
property
- name of the annotation property- Returns:
- list of defined values if present
-
booleanValue
Typed value of the property "value
".- Returns:
- value if present
-
booleanValue
Typed value of a named property.- Parameters:
property
- name of the annotation property- Returns:
- value if present
-
booleanValues
Typed value of the property "value
" that is defined as an array. This will also work for a single values property.- Returns:
- list of defined values if present
-
booleanValues
Typed values of a property that is defined as an array. This will also work for a single values property.- Parameters:
property
- name of the annotation property- Returns:
- list of defined values if present
-
byteValue
Typed value of the property "value
".- Returns:
- value if present
-
byteValue
Typed value of a named property.- Parameters:
property
- name of the annotation property- Returns:
- value if present
-
byteValues
Typed value of the property "value
" that is defined as an array. This will also work for a single values property.- Returns:
- list of defined values if present
-
byteValues
Typed values of a property that is defined as an array. This will also work for a single values property.- Parameters:
property
- name of the annotation property- Returns:
- list of defined values if present
-
charValue
Typed value of the property "value
".- Returns:
- value if present
-
charValue
Typed value of a named property.- Parameters:
property
- name of the annotation property- Returns:
- value if present
-
charValues
Typed value of the property "value
" that is defined as an array. This will also work for a single values property.- Returns:
- list of defined values if present
-
charValues
Typed values of a property that is defined as an array. This will also work for a single values property.- Parameters:
property
- name of the annotation property- Returns:
- list of defined values if present
-
shortValue
Typed value of the property "value
".- Returns:
- value if present
-
shortValue
Typed value of a named property.- Parameters:
property
- name of the annotation property- Returns:
- value if present
-
shortValues
Typed value of the property "value
" that is defined as an array. This will also work for a single values property.- Returns:
- list of defined values if present
-
shortValues
Typed values of a property that is defined as an array. This will also work for a single values property.- Parameters:
property
- name of the annotation property- Returns:
- list of defined values if present
-
floatValue
Typed value of the property "value
".- Returns:
- value if present
-
floatValue
Typed value of a named property.- Parameters:
property
- name of the annotation property- Returns:
- value if present
-
floatValues
Typed value of the property "value
" that is defined as an array. This will also work for a single values property.- Returns:
- list of defined values if present
-
floatValues
Typed values of a property that is defined as an array. This will also work for a single values property.- Parameters:
property
- name of the annotation property- Returns:
- list of defined values if present
-
doubleValue
Typed value of the property "value
".- Returns:
- value if present
-
doubleValue
Typed value of a named property.- Parameters:
property
- name of the annotation property- Returns:
- value if present
-
doubleValues
Typed value of the property "value
" that is defined as an array. This will also work for a single values property.- Returns:
- list of defined values if present
-
doubleValues
Typed values of a property that is defined as an array. This will also work for a single values property.- Parameters:
property
- name of the annotation property- Returns:
- list of defined values if present
-
classValue
Typed value of the property "value
".- Returns:
- value if present
-
classValue
Typed value of a named property.- Parameters:
property
- name of the annotation property- Returns:
- value if present
-
classValues
Typed value of the property "value
" that is defined as an array. This will also work for a single values property.- Returns:
- list of defined values if present
-
classValues
Typed values of a property that is defined as an array. This will also work for a single values property.- Parameters:
property
- name of the annotation property- Returns:
- list of defined values if present
-
typeValue
Typed value of the property "value
". Alternative forclassValue()
.- Returns:
- value if present
-
typeValue
Typed value of a named property. Alternative forclassValue(String)
.- Parameters:
property
- name of the annotation property- Returns:
- value if present
-
typeValues
Typed value of the property "value
" that is defined as an array. This will also work for a single values property. Alternative forclassValues()
.- Returns:
- list of defined values if present
-
typeValues
Typed values of a property that is defined as an array. This will also work for a single values property. Alternative forclassValues(String)
.- Parameters:
property
- name of the annotation property- Returns:
- list of defined values if present
-
annotationValue
Typed value of the property "value
".- Returns:
- value if present
-
annotationValue
Typed value of a named property.- Parameters:
property
- name of the annotation property- Returns:
- value if present
-
annotationValues
Typed value of the property "value
" that is defined as an array. This will also work for a single values property.- Returns:
- list of defined values if present
-
annotationValues
Typed values of a property that is defined as an array. This will also work for a single values property.- Parameters:
property
- name of the annotation property- Returns:
- list of defined values if present
-
enumValue
Typed value of the property "value
".- Type Parameters:
T
- type of the enumeration- Parameters:
type
- class of the enumeration- Returns:
- value if present
-
enumValue
Typed value of a named property.- Type Parameters:
T
- type of the enumeration- Parameters:
property
- name of the annotation propertytype
- class of the enumeration- Returns:
- value if present
-
enumValues
Typed value of the property "value
" that is defined as an array. This will also work for a single values property.- Type Parameters:
T
- type of the enumeration- Parameters:
type
- class of the enumeration- Returns:
- list of defined values if present
-
enumValues
Typed values of a property that is defined as an array. This will also work for a single values property.- Type Parameters:
T
- type of the enumeration- Parameters:
property
- name of the annotation propertytype
- class of the enumeration- Returns:
- list of defined values if present
-
hasMetaAnnotation
Check ifAnnotationBlueprint.metaAnnotations()
contains an annotation of the provided type.Note: we ignore
Target
,Inherited
,Documented
, andRetention
.- Parameters:
annotationType
- type of annotation- Returns:
true
if the annotation is declared on this annotation, or is inherited from a declared annotation
-