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

pack-priv Class AnnotationProxy

extends Object
implements Annotation, InvocationHandler, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, java.lang.reflect.InvocationHandler, java.lang.annotation.Annotation
Imports
java.io.Serializable, java.lang.annotation.Annotation, java.lang.reflect.InvocationHandler, .Method, .Proxy, java.security.AccessController, .PrivilegedAction, java.util.Arrays, .Map, .Map.Entry, org.hibernate.validator.internal.IgnoreForbiddenApisErrors, org.hibernate.validator.internal.util.privilegedactions.GetAnnotationAttributes

A concrete implementation of Annotation that pretends it is a "real" source code annotation. It's also an InvocationHandler.

When you create an AnnotationProxy, you must initialize it with an AnnotationDescriptor. The adapter checks that the provided elements are the same elements defined in the annotation interface. However, it does not check that their values are the right type. If you omit an element, the adapter will use the default value for that element from the annotation interface, if it exists. If no default exists, it will throw an exception.

Authors
Paolo Perrotta, Davide Marchignoli, Gunnar Morling, Guillaume Smet
See Also
java.lang.annotation.Annotation

Field Summary

Modifier and TypeField and Description
private final AnnotationDescriptor<? extends Annotation>
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Class<? extends Annotation>
annotationType()

Implements java.lang.annotation.Annotation.annotationType.

Returns the annotation interface of this annotation.
private boolean
public boolean

Returns:

Whether the given object is equal to this annotation proxy or not
equals
(Object
The object to compare
obj
)

Overrides java.lang.Object.equals.

Implements java.lang.annotation.Annotation.equals.

Performs an equality check as described in Annotation#equals(Object).
private @IgnoreForbiddenApisErrors(reason: "SecurityManager is deprecated in JDK17") Map<String, Object>
public int

Returns:

The hash code of this proxy.
hashCode
()

Overrides java.lang.Object.hashCode.

Implements java.lang.annotation.Annotation.hashCode.

Calculates the hash code of this annotation proxy as described in Annotation#hashCode().
public Object
invoke(Object
the proxy instance that the method was invoked on
proxy
,
Method
the Method instance corresponding to the interface method invoked on the proxy instance. The declaring class of the Method object will be the interface that the method was declared in, which may be a superinterface of the proxy interface that the proxy class inherits the method through.
method
,
Object[]
an array of objects containing the values of the arguments passed in the method invocation on the proxy instance, or null if interface method takes no arguments. Arguments of primitive types are wrapped in instances of the appropriate primitive wrapper class, such as java.lang.Integer or java.lang.Boolean.
args
)

Implements java.lang.reflect.InvocationHandler.invoke.

Processes a method invocation on a proxy instance and returns the result.
private <T> T
run(PrivilegedAction<T> action)

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

public String
toString()

Overrides java.lang.Object.toString.

Implements java.lang.annotation.Annotation.toString.

Returns a string representation of this annotation.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

descriptorback to summary
private final AnnotationDescriptor<? extends Annotation> descriptor
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

AnnotationProxyback to summary
pack-priv AnnotationProxy(AnnotationDescriptor<? extends Annotation> descriptor)

Method Detail

annotationTypeback to summary
public Class<? extends Annotation> annotationType()

Implements java.lang.annotation.Annotation.annotationType.

Doc from java.lang.annotation.Annotation.annotationType.

Returns the annotation interface of this annotation.

Returns:Class<? extends Annotation>

the annotation interface of this annotation

Annotations
@Override
areEqualback to summary
private boolean areEqual(Object o1, Object o2)
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Implements java.lang.annotation.Annotation.equals.

Performs an equality check as described in Annotation#equals(Object).

Parameters
obj:Object

The object to compare

Returns:boolean

Whether the given object is equal to this annotation proxy or not

Annotations
@Override
See Also
Annotation#equals(Object)
getAnnotationAttributesback to summary
private @IgnoreForbiddenApisErrors(reason: "SecurityManager is deprecated in JDK17") Map<String, Object> getAnnotationAttributes(Annotation annotation)
Annotations
@IgnoreForbiddenApisErrors
reason:SecurityManager is deprecated in JDK17
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Implements java.lang.annotation.Annotation.hashCode.

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

Returns:int

The hash code of this proxy.

Annotations
@Override
See Also
Annotation#hashCode()
invokeback to summary
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable

Implements java.lang.reflect.InvocationHandler.invoke.

Doc from java.lang.reflect.InvocationHandler.invoke.

Processes a method invocation on a proxy instance and returns the result. This method will be invoked on an invocation handler when a method is invoked on a proxy instance that it is associated with.

Parameters
proxy:Object

the proxy instance that the method was invoked on

method:Method

the Method instance corresponding to the interface method invoked on the proxy instance. The declaring class of the Method object will be the interface that the method was declared in, which may be a superinterface of the proxy interface that the proxy class inherits the method through.

args:Object[]

an array of objects containing the values of the arguments passed in the method invocation on the proxy instance, or null if interface method takes no arguments. Arguments of primitive types are wrapped in instances of the appropriate primitive wrapper class, such as java.lang.Integer or java.lang.Boolean.

Returns:Object

the value to return from the method invocation on the proxy instance. If the declared return type of the interface method is a primitive type, then the value returned by this method must be an instance of the corresponding primitive wrapper class; otherwise, it must be a type assignable to the declared return type. If the value returned by this method is null and the interface method's return type is primitive, then a NullPointerException will be thrown by the method invocation on the proxy instance. If the value returned by this method is otherwise not compatible with the interface method's declared return type as described above, a ClassCastException will be thrown by the method invocation on the proxy instance.

Annotations
@Override
Exceptions
Throwable:
the exception to throw from the method invocation on the proxy instance. The exception's type must be assignable either to any of the exception types declared in the throws clause of the interface method or to the unchecked exception types java.lang.RuntimeException or java.lang.Error. If a checked exception is thrown by this method that is not assignable to any of the exception types declared in the throws clause of the interface method, then an UndeclaredThrowableException containing the exception that was thrown by this method will be thrown by the method invocation on the proxy instance.
runback to summary
private <T> T run(PrivilegedAction<T> 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.

Implements java.lang.annotation.Annotation.toString.

Doc from java.lang.annotation.Annotation.toString.

Returns a string representation of this annotation. The details of the representation are implementation-dependent, but the following may be regarded as typical:

  @com.example.Name(first="Duke", middle="of", last="Java")
Returns:String

a string representation of this annotation

Annotations
@Override