Top Description Inners Fields Constructors Methods
org.hibernate.validator.internal.util.annotation

public Class AnnotationDescriptor<A extends java.lang.annotation.Annotation>

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Known Direct Subclasses
org.hibernate.validator.internal.util.annotation.ConstraintAnnotationDescriptor
Static Imports
org.hibernate.validator.internal.util.CollectionHelper.newHashMap

Encapsulates the data you need to create an annotation. In particular, it stores the type of an Annotation instance and the values of its elements. The "elements" we're talking about are the annotation attributes, not its targets (the term "element" is used ambiguously in Java's annotations documentation).
Authors
Paolo Perrotta, Davide Marchignoli, Hardy Ferentschik, Gunnar Morling, Guillaume Smet

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private final A
private final Map<String, Object>
private final int
private static final Log
private final Class<A>

Constructor Summary

AccessConstructor and Description
public
AnnotationDescriptor(A annotation)

public
private
AnnotationDescriptor(Class<A> annotationType, Map<String, Object> attributes)

Method Summary

Modifier and TypeMethod and Description
private boolean
private int
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public A
public <T> T
getAttribute(String attributeName, Class<T> attributeType)

public Object
getAttribute(String attributeName)

public Map<String, Object>
public <T> T
getMandatoryAttribute(String attributeName, Class<T> attributeType)

private SortedSet<String>
public Class<A>
public int

Returns:

The hash code of this descriptor.
hashCode
()

Overrides java.lang.Object.hashCode.

Calculates the hash code of this annotation descriptor as described in Annotation#hashCode().
private static <V> V
run(PrivilegedAction<V> action)

Runs the given privileged action, using a privileged block if required

Note

This must never be changed into a publicly available method to avoid execution of arbitrary privileged actions within HV's protection domain.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

annotationback to summary
private final A annotation
attributesback to summary
private final Map<String, Object> attributes
hashCodeback to summary
private final int hashCode
LOGback to summary
private static final Log LOG
typeback to summary
private final Class<A> type

Constructor Detail

AnnotationDescriptorback to summary
public AnnotationDescriptor(A annotation)
Annotations
@SuppressWarnings:unchecked
AnnotationDescriptorback to summary
public AnnotationDescriptor(AnnotationDescriptor<A> descriptor)
AnnotationDescriptorback to summary
private AnnotationDescriptor(Class<A> annotationType, Map<String, Object> attributes)

Method Detail

areEqualback to summary
private boolean areEqual(Object o1, Object o2)
buildHashCodeback to summary
private int buildHashCode()
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getAnnotationback to summary
public A getAnnotation()
getAttributeback to summary
public <T> T getAttribute(String attributeName, Class<T> attributeType)
Annotations
@SuppressWarnings:unchecked
getAttributeback to summary
public Object getAttribute(String attributeName)
getAttributesback to summary
public Map<String, Object> getAttributes()
getMandatoryAttributeback to summary
public <T> T getMandatoryAttribute(String attributeName, Class<T> attributeType)
Annotations
@SuppressWarnings:unchecked
getRegisteredAttributesInAlphabeticalOrderback to summary
private SortedSet<String> getRegisteredAttributesInAlphabeticalOrder()
getTypeback to summary
public Class<A> getType()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Calculates the hash code of this annotation descriptor as described in Annotation#hashCode().

Returns:int

The hash code of this descriptor.

Annotations
@Override
See Also
Annotation#hashCode()
runback to summary
private static <V> V run(PrivilegedAction<V> action)

Runs the given privileged action, using a privileged block if required

Note

This must never be changed into a publicly available method to avoid execution of arbitrary privileged actions within HV's protection domain.

Annotations
@IgnoreForbiddenApisErrors
reason:SecurityManager is deprecated in JDK17
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
org.hibernate.validator.internal.util.annotation back to summary

public Class AnnotationDescriptor.Builder<S extends java.lang.annotation.Annotation>

extends Object
Class Inheritance
  • java.lang.Object
  • org.hibernate.validator.internal.util.annotation.AnnotationDescriptor.Builder
Known Direct Subclasses
org.hibernate.validator.internal.util.annotation.ConstraintAnnotationDescriptor.Builder

Field Summary

Modifier and TypeField and Description
private final Map<String, Object>
private final Class<S>

Constructor Summary

AccessConstructor and Description
public
Builder(Class<S> type)

public
Builder(Class<S> type, Map<String, Object> attributes)

public
Builder(S annotation)

Method Summary

Modifier and TypeMethod and Description
public AnnotationDescriptor<S>
private Map<String, Object>
private SortedSet<String>
public Class<S>
public boolean
public void
setAttribute(String attributeName, Object value)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

attributesback to summary
private final Map<String, Object> attributes
typeback to summary
private final Class<S> type

Constructor Detail

Builderback to summary
public Builder(Class<S> type)
Builderback to summary
public Builder(Class<S> type, Map<String, Object> attributes)
Builderback to summary
public Builder(S annotation)
Annotations
@SuppressWarnings:unchecked

Method Detail

buildback to summary
public AnnotationDescriptor<S> build()
getAnnotationAttributesback to summary
private Map<String, Object> getAnnotationAttributes()
getRegisteredAttributesInAlphabeticalOrderback to summary
private SortedSet<String> getRegisteredAttributesInAlphabeticalOrder()
getTypeback to summary
public Class<S> getType()
hasAttributeback to summary
public boolean hasAttribute(String key)
setAttributeback to summary
public void setAttribute(String attributeName, Object value)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override