APIdia Launch Partner
Top Description Fields Constructors Methods
java.lang.annotation

public Class AnnotationTypeMismatchException

extends RuntimeException
Class Inheritance
Imports
java.lang.reflect.Method

Thrown to indicate that a program has attempted to access an element of an annotation whose type has changed after the annotation was compiled (or serialized). This exception can be thrown by the API used to read annotations reflectively.
Author
Josh Bloch
Since
1.5
See Also
java.lang.reflect.AnnotatedElement

Field Summary

Modifier and TypeField and Description
private final transient Method
element

The Method object for the annotation element.

private final String
private static final long

Constructor Summary

AccessConstructor and Description
public
AnnotationTypeMismatchException(Method
the Method object for the annotation element, may be null
element
,
String
the (erroneous) type of data found in the annotation. This string may, but is not required to, contain the value as well. The exact format of the string is unspecified, may be null.
foundType
)

Constructs an AnnotationTypeMismatchException for the specified annotation type element and found data type.

Method Summary

Modifier and TypeMethod and Description
public Method

Returns:

the Method object for the incorrectly typed element, or null if unavailable
element
()

Returns the Method object for the incorrectly typed element.

public String

Returns:

the type of data found in the incorrectly typed element
foundType
()

Returns the type of data found in the incorrectly typed element.

Field Detail

elementback to summary
private final transient Method element

The Method object for the annotation element.

foundTypeback to summary
private final String foundType
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.RuntimeException.serialVersionUID.

Annotations
@Serial

Constructor Detail

AnnotationTypeMismatchExceptionback to summary
public AnnotationTypeMismatchException(Method element, String foundType)

Constructs an AnnotationTypeMismatchException for the specified annotation type element and found data type.

Parameters
element:Method

the Method object for the annotation element, may be null

foundType:String

the (erroneous) type of data found in the annotation. This string may, but is not required to, contain the value as well. The exact format of the string is unspecified, may be null.

Method Detail

elementback to summary
public Method element()

Returns the Method object for the incorrectly typed element. The value may be unavailable if this exception has been serialized and then read back in.

Returns:Method

the Method object for the incorrectly typed element, or null if unavailable

foundTypeback to summary
public String foundType()

Returns the type of data found in the incorrectly typed element. The returned string may, but is not required to, contain the value as well. The exact format of the string is unspecified and the string may be null.

Returns:String

the type of data found in the incorrectly typed element