Top Description Fields Constructors Methods
org.springframework.core.annotation

pack-priv abstract Class AbstractMergedAnnotation<A extends Annotation>

extends Object
implements MergedAnnotation<A extends Annotation>
Class Inheritance
All Implemented Interfaces
org.springframework.core.annotation.MergedAnnotation
Known Direct Subclasses
org.springframework.core.annotation.MissingMergedAnnotation, org.springframework.core.annotation.TypeMappedAnnotation
Type Parameters
<A>
the annotation type
Imports
java.lang.annotation.Annotation, java.util.NoSuchElementException, .Optional, java.util.function.Predicate, org.springframework.lang.Nullable, org.springframework.util.Assert

Abstract base class for MergedAnnotation implementations.
Authors
Phillip Webb, Juergen Hoeller
Since
5.2

Field Summary

Modifier and TypeField and Description
private volatile A

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public AnnotationAttributes
asAnnotationAttributes(MergedAnnotation.Adapt...
the adaptations that should be applied to the annotation values
adaptations
)

Implements org.springframework.core.annotation.MergedAnnotation.asAnnotationAttributes.

Create a new mutable AnnotationAttributes instance from this merged annotation.

protected abstract A
createSynthesizedAnnotation()

Factory method used to create the synthesized annotation.

public MergedAnnotation<A>
filterDefaultValues()

Implements org.springframework.core.annotation.MergedAnnotation.filterDefaultValues.

Create a new view of the annotation with all attributes that have default values removed.

protected abstract <T> T

Returns:

the attribute value or null if the value is not found and is not required
getAttributeValue
(String
the attribute name
attributeName
,
Class<T>
the type to return (see MergedAnnotation class documentation for details)
type
)

Get the underlying attribute value.

public boolean
getBoolean(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.getBoolean.

Get a required boolean attribute value from the annotation.

public boolean[]
getBooleanArray(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.getBooleanArray.

Get a required boolean array attribute value from the annotation.

public byte
getByte(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.getByte.

Get a required byte attribute value from the annotation.

public byte[]
getByteArray(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.getByteArray.

Get a required byte array attribute value from the annotation.

public char
getChar(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.getChar.

Get a required char attribute value from the annotation.

public char[]
getCharArray(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.getCharArray.

Get a required char array attribute value from the annotation.

public Class<?>
getClass(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.getClass.

Get a required class attribute value from the annotation.

public Class<?>[]
getClassArray(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.getClassArray.

Get a required class array attribute value from the annotation.

public Optional<Object>
getDefaultValue(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.getDefaultValue.

Get the default attribute value from the annotation as specified in the annotation declaration.

public double
getDouble(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.getDouble.

Get a required double attribute value from the annotation.

public double[]
getDoubleArray(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.getDoubleArray.

Get a required double array attribute value from the annotation.

public <E extends Enum<E>> E
getEnum(String
the attribute name
attributeName
,
Class<E>
the enum type
type
)

Implements org.springframework.core.annotation.MergedAnnotation.getEnum.

Get a required enum attribute value from the annotation.

public <E extends Enum<E>> E[]
getEnumArray(String
the attribute name
attributeName
,
Class<E>
the enum type
type
)

Implements org.springframework.core.annotation.MergedAnnotation.getEnumArray.

Get a required enum array attribute value from the annotation.

public float
getFloat(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.getFloat.

Get a required float attribute value from the annotation.

public float[]
getFloatArray(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.getFloatArray.

Get a required float array attribute value from the annotation.

public int
getInt(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.getInt.

Get a required int attribute value from the annotation.

public int[]
getIntArray(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.getIntArray.

Get a required int array attribute value from the annotation.

public long
getLong(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.getLong.

Get a required long attribute value from the annotation.

public long[]
getLongArray(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.getLongArray.

Get a required long array attribute value from the annotation.

private <T> T
getRequiredAttributeValue(String attributeName, Class<T> type)

public short
getShort(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.getShort.

Get a required short attribute value from the annotation.

public short[]
getShortArray(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.getShortArray.

Get a required short array attribute value from the annotation.

public String
getString(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.getString.

Get a required string attribute value from the annotation.

public String[]
getStringArray(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.getStringArray.

Get a required string array attribute value from the annotation.

public Optional<Object>
getValue(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.getValue.

Get an optional attribute value from the annotation.

public <T> Optional<T>
getValue(String
the attribute name
attributeName
,
Class<T>
the attribute type. Must be compatible with the underlying attribute type or Object.class.
type
)

Implements org.springframework.core.annotation.MergedAnnotation.getValue.

Get an optional attribute value from the annotation.

public boolean
hasNonDefaultValue(String
the attribute name
attributeName
)

Implements org.springframework.core.annotation.MergedAnnotation.hasNonDefaultValue.

Determine if the specified attribute name has a non-default value when compared to the annotation declaration.

public boolean
isDirectlyPresent()

Implements org.springframework.core.annotation.MergedAnnotation.isDirectlyPresent.

Determine if the annotation is directly present on the source.

public boolean
isMetaPresent()

Implements org.springframework.core.annotation.MergedAnnotation.isMetaPresent.

Determine if the annotation is meta-present on the source.

public Optional<A>
synthesize(Predicate<? super MergedAnnotation<A>>
the test to determine if the annotation can be synthesized
condition
)

Implements org.springframework.core.annotation.MergedAnnotation.synthesize.

Optionally create a type-safe synthesized version of this annotation based on a condition predicate.

public A
synthesize()

Implements org.springframework.core.annotation.MergedAnnotation.synthesize.

Create a type-safe synthesized version of this merged annotation that can be used directly in code.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

synthesizedAnnotationback to summary
private volatile A synthesizedAnnotation
Annotations
@Nullable

Constructor Detail

AbstractMergedAnnotationback to summary
pack-priv AbstractMergedAnnotation()

Method Detail

asAnnotationAttributesback to summary
public AnnotationAttributes asAnnotationAttributes(MergedAnnotation.Adapt... adaptations)

Implements org.springframework.core.annotation.MergedAnnotation.asAnnotationAttributes.

Doc from org.springframework.core.annotation.MergedAnnotation.asAnnotationAttributes.

Create a new mutable AnnotationAttributes instance from this merged annotation.

The adaptations may be used to change the way that values are added.

Parameters
adaptations:MergedAnnotation.Adapt[]

the adaptations that should be applied to the annotation values

Returns:AnnotationAttributes

an immutable map containing the attributes and values

Annotations
@Override
createSynthesizedAnnotationback to summary
protected abstract A createSynthesizedAnnotation()

Factory method used to create the synthesized annotation.

If the source is an annotation that is not synthesizable, it will be returned unmodified.

Consult the documentation for MergedAnnotation#synthesize() for an explanation of what is considered synthesizable.

filterDefaultValuesback to summary
public MergedAnnotation<A> filterDefaultValues()

Implements org.springframework.core.annotation.MergedAnnotation.filterDefaultValues.

Doc from org.springframework.core.annotation.MergedAnnotation.filterDefaultValues.

Create a new view of the annotation with all attributes that have default values removed.

Returns:MergedAnnotation<A>

a filtered view of the annotation without any attributes that have a default value

Annotations
@Override
getAttributeValueback to summary
protected abstract <T> T getAttributeValue(String attributeName, Class<T> type)

Get the underlying attribute value.

Parameters
attributeName:String

the attribute name

type:Class<T>

the type to return (see MergedAnnotation class documentation for details)

Returns:T

the attribute value or null if the value is not found and is not required

Annotations
@Nullable
Exceptions
IllegalArgumentException:
if the source type is not compatible
NoSuchElementException:
if the value is required but not found
getBooleanback to summary
public boolean getBoolean(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.getBoolean.

Doc from org.springframework.core.annotation.MergedAnnotation.getBoolean.

Get a required boolean attribute value from the annotation.

Parameters
attributeName:String

the attribute name

Returns:boolean

the value as a boolean

Annotations
@Override
getBooleanArrayback to summary
public boolean[] getBooleanArray(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.getBooleanArray.

Doc from org.springframework.core.annotation.MergedAnnotation.getBooleanArray.

Get a required boolean array attribute value from the annotation.

Parameters
attributeName:String

the attribute name

Returns:boolean[]

the value as a boolean array

Annotations
@Override
getByteback to summary
public byte getByte(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.getByte.

Doc from org.springframework.core.annotation.MergedAnnotation.getByte.

Get a required byte attribute value from the annotation.

Parameters
attributeName:String

the attribute name

Returns:byte

the value as a byte

Annotations
@Override
getByteArrayback to summary
public byte[] getByteArray(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.getByteArray.

Doc from org.springframework.core.annotation.MergedAnnotation.getByteArray.

Get a required byte array attribute value from the annotation.

Parameters
attributeName:String

the attribute name

Returns:byte[]

the value as a byte array

Annotations
@Override
getCharback to summary
public char getChar(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.getChar.

Doc from org.springframework.core.annotation.MergedAnnotation.getChar.

Get a required char attribute value from the annotation.

Parameters
attributeName:String

the attribute name

Returns:char

the value as a char

Annotations
@Override
getCharArrayback to summary
public char[] getCharArray(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.getCharArray.

Doc from org.springframework.core.annotation.MergedAnnotation.getCharArray.

Get a required char array attribute value from the annotation.

Parameters
attributeName:String

the attribute name

Returns:char[]

the value as a char array

Annotations
@Override
getClassback to summary
public Class<?> getClass(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.getClass.

Doc from org.springframework.core.annotation.MergedAnnotation.getClass.

Get a required class attribute value from the annotation.

Parameters
attributeName:String

the attribute name

Returns:Class<?>

the value as a class

Annotations
@Override
getClassArrayback to summary
public Class<?>[] getClassArray(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.getClassArray.

Doc from org.springframework.core.annotation.MergedAnnotation.getClassArray.

Get a required class array attribute value from the annotation.

Parameters
attributeName:String

the attribute name

Returns:Class<?>[]

the value as a class array

Annotations
@Override
getDefaultValueback to summary
public Optional<Object> getDefaultValue(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.getDefaultValue.

Doc from org.springframework.core.annotation.MergedAnnotation.getDefaultValue.

Get the default attribute value from the annotation as specified in the annotation declaration.

Parameters
attributeName:String

the attribute name

Returns:Optional<Object>

an optional of the default value or Optional#empty() if there is no matching attribute or no defined default

Annotations
@Override
getDoubleback to summary
public double getDouble(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.getDouble.

Doc from org.springframework.core.annotation.MergedAnnotation.getDouble.

Get a required double attribute value from the annotation.

Parameters
attributeName:String

the attribute name

Returns:double

the value as a double

Annotations
@Override
getDoubleArrayback to summary
public double[] getDoubleArray(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.getDoubleArray.

Doc from org.springframework.core.annotation.MergedAnnotation.getDoubleArray.

Get a required double array attribute value from the annotation.

Parameters
attributeName:String

the attribute name

Returns:double[]

the value as a double array

Annotations
@Override
getEnumback to summary
public <E extends Enum<E>> E getEnum(String attributeName, Class<E> type)

Implements org.springframework.core.annotation.MergedAnnotation.getEnum.

Doc from org.springframework.core.annotation.MergedAnnotation.getEnum.

Get a required enum attribute value from the annotation.

Parameters
attributeName:String

the attribute name

type:Class<E>

the enum type

Returns:E

the value as an enum

Annotations
@Override
getEnumArrayback to summary
public <E extends Enum<E>> E[] getEnumArray(String attributeName, Class<E> type)

Implements org.springframework.core.annotation.MergedAnnotation.getEnumArray.

Doc from org.springframework.core.annotation.MergedAnnotation.getEnumArray.

Get a required enum array attribute value from the annotation.

Parameters
attributeName:String

the attribute name

type:Class<E>

the enum type

Returns:E[]

the value as an enum array

Annotations
@Override
@SuppressWarnings:unchecked
getFloatback to summary
public float getFloat(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.getFloat.

Doc from org.springframework.core.annotation.MergedAnnotation.getFloat.

Get a required float attribute value from the annotation.

Parameters
attributeName:String

the attribute name

Returns:float

the value as a float

Annotations
@Override
getFloatArrayback to summary
public float[] getFloatArray(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.getFloatArray.

Doc from org.springframework.core.annotation.MergedAnnotation.getFloatArray.

Get a required float array attribute value from the annotation.

Parameters
attributeName:String

the attribute name

Returns:float[]

the value as a float array

Annotations
@Override
getIntback to summary
public int getInt(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.getInt.

Doc from org.springframework.core.annotation.MergedAnnotation.getInt.

Get a required int attribute value from the annotation.

Parameters
attributeName:String

the attribute name

Returns:int

the value as an int

Annotations
@Override
getIntArrayback to summary
public int[] getIntArray(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.getIntArray.

Doc from org.springframework.core.annotation.MergedAnnotation.getIntArray.

Get a required int array attribute value from the annotation.

Parameters
attributeName:String

the attribute name

Returns:int[]

the value as an int array

Annotations
@Override
getLongback to summary
public long getLong(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.getLong.

Doc from org.springframework.core.annotation.MergedAnnotation.getLong.

Get a required long attribute value from the annotation.

Parameters
attributeName:String

the attribute name

Returns:long

the value as a long

Annotations
@Override
getLongArrayback to summary
public long[] getLongArray(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.getLongArray.

Doc from org.springframework.core.annotation.MergedAnnotation.getLongArray.

Get a required long array attribute value from the annotation.

Parameters
attributeName:String

the attribute name

Returns:long[]

the value as a long array

Annotations
@Override
getRequiredAttributeValueback to summary
private <T> T getRequiredAttributeValue(String attributeName, Class<T> type)
getShortback to summary
public short getShort(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.getShort.

Doc from org.springframework.core.annotation.MergedAnnotation.getShort.

Get a required short attribute value from the annotation.

Parameters
attributeName:String

the attribute name

Returns:short

the value as a short

Annotations
@Override
getShortArrayback to summary
public short[] getShortArray(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.getShortArray.

Doc from org.springframework.core.annotation.MergedAnnotation.getShortArray.

Get a required short array attribute value from the annotation.

Parameters
attributeName:String

the attribute name

Returns:short[]

the value as a short array

Annotations
@Override
getStringback to summary
public String getString(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.getString.

Doc from org.springframework.core.annotation.MergedAnnotation.getString.

Get a required string attribute value from the annotation.

Parameters
attributeName:String

the attribute name

Returns:String

the value as a string

Annotations
@Override
getStringArrayback to summary
public String[] getStringArray(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.getStringArray.

Doc from org.springframework.core.annotation.MergedAnnotation.getStringArray.

Get a required string array attribute value from the annotation.

Parameters
attributeName:String

the attribute name

Returns:String[]

the value as a string array

Annotations
@Override
getValueback to summary
public Optional<Object> getValue(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.getValue.

Doc from org.springframework.core.annotation.MergedAnnotation.getValue.

Get an optional attribute value from the annotation.

Parameters
attributeName:String

the attribute name

Returns:Optional<Object>

an optional value or Optional#empty() if there is no matching attribute

Annotations
@Override
getValueback to summary
public <T> Optional<T> getValue(String attributeName, Class<T> type)

Implements org.springframework.core.annotation.MergedAnnotation.getValue.

Doc from org.springframework.core.annotation.MergedAnnotation.getValue.

Get an optional attribute value from the annotation.

Parameters
attributeName:String

the attribute name

type:Class<T>

the attribute type. Must be compatible with the underlying attribute type or Object.class.

Returns:Optional<T>

an optional value or Optional#empty() if there is no matching attribute

Annotations
@Override
hasNonDefaultValueback to summary
public boolean hasNonDefaultValue(String attributeName)

Implements org.springframework.core.annotation.MergedAnnotation.hasNonDefaultValue.

Doc from org.springframework.core.annotation.MergedAnnotation.hasNonDefaultValue.

Determine if the specified attribute name has a non-default value when compared to the annotation declaration.

Parameters
attributeName:String

the attribute name

Returns:boolean

true if the attribute value is different from the default value

Annotations
@Override
isDirectlyPresentback to summary
public boolean isDirectlyPresent()

Implements org.springframework.core.annotation.MergedAnnotation.isDirectlyPresent.

Doc from org.springframework.core.annotation.MergedAnnotation.isDirectlyPresent.

Determine if the annotation is directly present on the source.

A directly present annotation is one that the user has explicitly declared and not one that is meta-present or @Inherited.

Returns:boolean

true if the annotation is directly present

Annotations
@Override
isMetaPresentback to summary
public boolean isMetaPresent()

Implements org.springframework.core.annotation.MergedAnnotation.isMetaPresent.

Doc from org.springframework.core.annotation.MergedAnnotation.isMetaPresent.

Determine if the annotation is meta-present on the source.

A meta-present annotation is an annotation that the user hasn't explicitly declared, but has been used as a meta-annotation somewhere in the annotation hierarchy.

Returns:boolean

true if the annotation is meta-present

Annotations
@Override
synthesizeback to summary
public Optional<A> synthesize(Predicate<? super MergedAnnotation<A>> condition) throws NoSuchElementException

Implements org.springframework.core.annotation.MergedAnnotation.synthesize.

Doc from org.springframework.core.annotation.MergedAnnotation.synthesize.

Optionally create a type-safe synthesized version of this annotation based on a condition predicate.

The result is synthesized using a JDK Proxy and as a result may incur a computational cost when first invoked.

Consult the documentation for synthesize() for an explanation of what is considered synthesizable.

Parameters
condition:Predicate<? super MergedAnnotation<A>>

the test to determine if the annotation can be synthesized

Returns:Optional<A>

an optional containing the synthesized version of the annotation or an empty optional if the condition doesn't match

Annotations
@Override
Exceptions
NoSuchElementException:
on a missing annotation
synthesizeback to summary
public A synthesize()

Implements org.springframework.core.annotation.MergedAnnotation.synthesize.

Doc from org.springframework.core.annotation.MergedAnnotation.synthesize.

Create a type-safe synthesized version of this merged annotation that can be used directly in code.

The result is synthesized using a JDK Proxy and as a result may incur a computational cost when first invoked.

If this merged annotation was created from a map of annotation attributes or default attribute values, those attributes will always be synthesized into an annotation instance.

If this merged annotation was created from an annotation instance, that annotation will be returned unmodified if it is not synthesizable. An annotation is considered synthesizable if it has not already been synthesized and one of the following is true.

  • The annotation declares attributes annotated with @AliasFor.
  • The annotation is a composed annotation that relies on convention-based annotation attribute overrides in meta-annotations.
  • The annotation declares attributes that are annotations or arrays of annotations that are themselves synthesizable.
Returns:A

a synthesized version of the annotation or the original annotation unmodified

Annotations
@Override