java.lang.annotation

Interface Annotation

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.
booleanequals(Object o)

Returns true if the supplied object is equivalent to this annotation.

inthashCode()

Returns the hash code of the annotation.

StringtoString()
Returns a textual representation of the annotation.

Method Detail

annotationType

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

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

equals

public 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

public 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:

Returns: the hash code of the annotation, computed as the sum of its member hashcodes.

toString

public 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.

Returns: a textual representation of the annotation.