|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.lang3.AnnotationUtils
public class AnnotationUtils
Helper methods for working with Annotation
instances.
This class contains various utility methods that make working with annotations simpler.
Annotation
instances are always proxy objects; unfortunately
dynamic proxies cannot be depended upon to know how to implement certain
methods in the same manner as would be done by "natural" Annotation
s.
The methods presented in this class can be used to avoid that possibility. It
is of course also possible for dynamic proxies to actually delegate their
e.g. Annotation.equals(Object)
/Annotation.hashCode()
/
Annotation.toString()
implementations to AnnotationUtils
.
#ThreadSafe#
Constructor Summary | |
---|---|
AnnotationUtils()
AnnotationUtils instances should NOT be constructed in
standard programming. |
Method Summary | |
---|---|
static boolean |
equals(Annotation a1,
Annotation a2)
Checks if two annotations are equal using the criteria for equality presented in the Annotation.equals(Object) API docs. |
static int |
hashCode(Annotation a)
Generate a hash code for the given annotation using the algorithm presented in the Annotation.hashCode() API docs. |
static boolean |
isValidAnnotationMemberType(Class<?> type)
Checks if the specified type is permitted as an annotation member. |
static String |
toString(Annotation a)
Generate a string representation of an Annotation, as suggested by Annotation.toString() . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AnnotationUtils()
AnnotationUtils
instances should NOT be constructed in
standard programming. Instead, the class should be used statically.
This constructor is public to permit tools that require a JavaBean instance to operate.
Method Detail |
---|
public static boolean equals(Annotation a1, Annotation a2)
Checks if two annotations are equal using the criteria for equality
presented in the Annotation.equals(Object)
API docs.
a1
- the first Annotation to compare, null
returns
false
unless both are null
a2
- the second Annotation to compare, null
returns
false
unless both are null
true
if the two annotations are equal
or both
null
public static int hashCode(Annotation a)
Generate a hash code for the given annotation using the algorithm
presented in the Annotation.hashCode()
API docs.
a
- the Annotation for a hash code calculation is desired, not
null
RuntimeException
- if an Exception
is encountered during
annotation member access
IllegalStateException
- if an annotation method invocation returns
null
public static String toString(Annotation a)
Generate a string representation of an Annotation, as suggested by
Annotation.toString()
.
a
- the annotation of which a string representation is desired
null
public static boolean isValidAnnotationMemberType(Class<?> type)
Checks if the specified type is permitted as an annotation member.
The Java language specification only permits certain types to be used
in annotations. These include String
, Class
, primitive
types, Annotation
, Enum
, and single-dimensional arrays of
these types.
type
- the type to check, null
true
if the type is a valid type to use in an annotation
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |