java.lang.annotation
Interface Annotation

All Known Implementing Classes:
ConstructorProperties, Deprecated, Documented, Inherited, MXBean, Override, Retention, SuppressWarnings, Target

public interface Annotation

This is the common interface for all annotations. Note that classes that implement this class manually are not classed as annotations, and that this interface does not define an annotation type in itself.

Since:
1.5

Method Summary
 Class<? extends Annotation> annotationType()
          Returns the type of this annotation.
 boolean equals(Object o)
           Returns true if the supplied object is equivalent to this annotation.
 int hashCode()
           Returns the hash code of the annotation.
 String toString()
          Returns a textual representation of the annotation.
 

Method Detail

annotationType

Class<? extends Annotation> annotationType()
Returns the type of this annotation.

Returns:
the class of which this annotation is an instance.

equals

boolean equals(Object o)

Returns true if the supplied object is equivalent to this annotation. For this property to hold, the following must be true of o:


hashCode

int hashCode()

Returns the hash code of the annotation. This is computed as the sum of the hash codes of the annotation's members.

The hash code of a member of the annotation is the result of XORing the hash code of its value with the result of multiplying the hash code of its name by 127. Formally, if the value is v and the name is n, the hash code of the member is v.hashCode() XOR (127 * String.hashCode(n)). v.hashCode() is defined as follows:

Overrides:
hashCode in class Object
Returns:
the hash code of the annotation, computed as the sum of its member hashcodes.
See Also:
Object.equals(Object), System.identityHashCode(Object)

toString

String toString()
Returns a textual representation of the annotation. This is implementation-dependent, but is expected to include the classname and the names and values of each member.

Overrides:
toString in class Object
Returns:
a textual representation of the annotation.
See Also:
Object.getClass(), Object.hashCode(), Class.getName(), Integer.toHexString(int)