Annotation | java.lang.annotation |
A type declared with the
@interface syntax is an annotation type that
implicitly extends this interface. Note that the
Annotation interface is not itself an annotation
type. Furthermore, if you define an interface
(rather than an @interface) that explicitly
extends Annotation, the result is not an
annotation type either. The only way to define an annotation type is
with an @interface definition. When an annotation
is queried with the
java.lang.reflect.AnnotatedElement API, the object
returned implements this interface as well as the interface defined
by the specific annotation type.
This interface defines the annotationType(
) method, which returns the
Class of the annotation type for any annotation
object. It also includes the equals(
)
and hashCode( ) methods of
Object to require an implementation to compare
annotations by the values of their members rather than simply by
using = =. Finally, Annotation
also overrides the toString( ) method to require
implementations to provide some meaningful string representation of
an annotation. The format of the returned string is not specified,
but you can expect implementations to produce a string using a syntax
similar to that used to encode annotations in Java source code.
public interface Annotation {
// Public Instance Methods
Class<? extends java.lang.annotation.Annotation> annotationType( );
boolean equals(Object obj);
int hashCode( );
String toString( );
}
Implementations
Deprecated, Override,
SuppressWarnings, Documented,
Inherited, Retention,
Target
Returned By
Too many methods to list.
 |