private static class AnnotationUtils.AliasDescriptor
extends java.lang.Object
AliasDescriptor
encapsulates the declaration of @AliasFor
on a given annotation attribute and includes support for validating
the configuration of aliases (both explicit and implicit).Modifier and Type | Field and Description |
---|---|
private java.lang.Class<? extends java.lang.annotation.Annotation> |
aliasedAnnotationType |
private java.lang.reflect.Method |
aliasedAttribute |
private java.lang.String |
aliasedAttributeName |
private boolean |
isAliasPair |
private java.lang.Class<? extends java.lang.annotation.Annotation> |
sourceAnnotationType |
private java.lang.reflect.Method |
sourceAttribute |
private java.lang.String |
sourceAttributeName |
Modifier | Constructor and Description |
---|---|
private |
AliasDescriptor(java.lang.reflect.Method sourceAttribute,
AliasFor aliasFor) |
Modifier and Type | Method and Description |
---|---|
static AnnotationUtils.AliasDescriptor |
from(java.lang.reflect.Method attribute)
Create an
AliasDescriptor from the declaration
of @AliasFor on the supplied annotation attribute and
validate the configuration of @AliasFor . |
private java.lang.String |
getAliasedAttributeName(AliasFor aliasFor,
java.lang.reflect.Method attribute)
Get the name of the aliased attribute configured via the supplied
@AliasFor annotation on the supplied attribute ,
or the original attribute if no aliased one specified (indicating that
the reference goes to a same-named attribute on a meta-annotation). |
java.util.List<java.lang.String> |
getAttributeAliasNames() |
private AnnotationUtils.AliasDescriptor |
getAttributeOverrideDescriptor() |
java.lang.String |
getAttributeOverrideName(java.lang.Class<? extends java.lang.annotation.Annotation> metaAnnotationType) |
private java.util.List<AnnotationUtils.AliasDescriptor> |
getOtherDescriptors() |
private boolean |
isAliasFor(AnnotationUtils.AliasDescriptor otherDescriptor)
Determine if this descriptor and the supplied descriptor both
effectively represent aliases for the same attribute in the same
target annotation, either explicitly or implicitly.
|
private boolean |
isOverrideFor(java.lang.Class<? extends java.lang.annotation.Annotation> metaAnnotationType)
Determine if this descriptor represents an explicit override for
an attribute in the supplied
metaAnnotationType . |
java.lang.String |
toString() |
private void |
validate() |
private void |
validateAgainst(AnnotationUtils.AliasDescriptor otherDescriptor)
Validate this descriptor against the supplied descriptor.
|
private void |
validateDefaultValueConfiguration(java.lang.reflect.Method aliasedAttribute) |
private final java.lang.reflect.Method sourceAttribute
private final java.lang.Class<? extends java.lang.annotation.Annotation> sourceAnnotationType
private final java.lang.String sourceAttributeName
private final java.lang.reflect.Method aliasedAttribute
private final java.lang.Class<? extends java.lang.annotation.Annotation> aliasedAnnotationType
private final java.lang.String aliasedAttributeName
private final boolean isAliasPair
private AliasDescriptor(java.lang.reflect.Method sourceAttribute, AliasFor aliasFor)
@Nullable public static AnnotationUtils.AliasDescriptor from(java.lang.reflect.Method attribute)
AliasDescriptor
from the declaration
of @AliasFor
on the supplied annotation attribute and
validate the configuration of @AliasFor
.attribute
- the annotation attribute that is annotated with
@AliasFor
null
if the attribute
is not annotated with @AliasFor
validateAgainst(org.springframework.core.annotation.AnnotationUtils.AliasDescriptor)
private void validate()
private void validateDefaultValueConfiguration(java.lang.reflect.Method aliasedAttribute)
private void validateAgainst(AnnotationUtils.AliasDescriptor otherDescriptor)
This method only validates the configuration of default values for the two descriptors, since other aspects of the descriptors are validated when they are created.
private boolean isOverrideFor(java.lang.Class<? extends java.lang.annotation.Annotation> metaAnnotationType)
metaAnnotationType
.private boolean isAliasFor(AnnotationUtils.AliasDescriptor otherDescriptor)
This method searches the attribute override hierarchy, beginning with this descriptor, in order to detect implicit and transitively implicit aliases.
true
if this descriptor and the supplied descriptor
effectively alias the same annotation attributeisOverrideFor(java.lang.Class<? extends java.lang.annotation.Annotation>)
public java.util.List<java.lang.String> getAttributeAliasNames()
private java.util.List<AnnotationUtils.AliasDescriptor> getOtherDescriptors()
@Nullable public java.lang.String getAttributeOverrideName(java.lang.Class<? extends java.lang.annotation.Annotation> metaAnnotationType)
@Nullable private AnnotationUtils.AliasDescriptor getAttributeOverrideDescriptor()
private java.lang.String getAliasedAttributeName(AliasFor aliasFor, java.lang.reflect.Method attribute)
@AliasFor
annotation on the supplied attribute
,
or the original attribute if no aliased one specified (indicating that
the reference goes to a same-named attribute on a meta-annotation).
This method returns the value of either the attribute
or value
attribute of @AliasFor
, ensuring that only
one of the attributes has been declared while simultaneously ensuring
that at least one of the attributes has been declared.
aliasFor
- the @AliasFor
annotation from which to retrieve
the aliased attribute nameattribute
- the attribute that is annotated with @AliasFor
null
or empty)AnnotationConfigurationException
- if invalid configuration of
@AliasFor
is detectedpublic java.lang.String toString()
toString
in class java.lang.Object