0N/A/*
2362N/A * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.lang.annotation;
0N/A
0N/A/**
0N/A * The common interface extended by all annotation types. Note that an
0N/A * interface that manually extends this one does <i>not</i> define
0N/A * an annotation type. Also note that this interface does not itself
0N/A * define an annotation type.
0N/A *
4008N/A * More information about annotation types can be found in section 9.6 of
4008N/A * <cite>The Java&trade; Language Specification</cite>.
846N/A *
0N/A * @author Josh Bloch
0N/A * @since 1.5
0N/A */
0N/Apublic interface Annotation {
0N/A /**
0N/A * Returns true if the specified object represents an annotation
0N/A * that is logically equivalent to this one. In other words,
0N/A * returns true if the specified object is an instance of the same
0N/A * annotation type as this instance, all of whose members are equal
0N/A * to the corresponding member of this annotation, as defined below:
0N/A * <ul>
0N/A * <li>Two corresponding primitive typed members whose values are
0N/A * <tt>x</tt> and <tt>y</tt> are considered equal if <tt>x == y</tt>,
0N/A * unless their type is <tt>float</tt> or <tt>double</tt>.
0N/A *
0N/A * <li>Two corresponding <tt>float</tt> members whose values
0N/A * are <tt>x</tt> and <tt>y</tt> are considered equal if
0N/A * <tt>Float.valueOf(x).equals(Float.valueOf(y))</tt>.
0N/A * (Unlike the <tt>==</tt> operator, NaN is considered equal
0N/A * to itself, and <tt>0.0f</tt> unequal to <tt>-0.0f</tt>.)
0N/A *
0N/A * <li>Two corresponding <tt>double</tt> members whose values
0N/A * are <tt>x</tt> and <tt>y</tt> are considered equal if
0N/A * <tt>Double.valueOf(x).equals(Double.valueOf(y))</tt>.
0N/A * (Unlike the <tt>==</tt> operator, NaN is considered equal
0N/A * to itself, and <tt>0.0</tt> unequal to <tt>-0.0</tt>.)
0N/A *
0N/A * <li>Two corresponding <tt>String</tt>, <tt>Class</tt>, enum, or
0N/A * annotation typed members whose values are <tt>x</tt> and <tt>y</tt>
0N/A * are considered equal if <tt>x.equals(y)</tt>. (Note that this
0N/A * definition is recursive for annotation typed members.)
0N/A *
0N/A * <li>Two corresponding array typed members <tt>x</tt> and <tt>y</tt>
0N/A * are considered equal if <tt>Arrays.equals(x, y)</tt>, for the
0N/A * appropriate overloading of {@link java.util.Arrays#equals}.
0N/A * </ul>
0N/A *
0N/A * @return true if the specified object represents an annotation
0N/A * that is logically equivalent to this one, otherwise false
0N/A */
0N/A boolean equals(Object obj);
0N/A
0N/A /**
0N/A * Returns the hash code of this annotation, as defined below:
0N/A *
0N/A * <p>The hash code of an annotation is the sum of the hash codes
0N/A * of its members (including those with default values), as defined
0N/A * below:
0N/A *
0N/A * The hash code of an annotation member is (127 times the hash code
0N/A * of the member-name as computed by {@link String#hashCode()}) XOR
0N/A * the hash code of the member-value, as defined below:
0N/A *
0N/A * <p>The hash code of a member-value depends on its type:
0N/A * <ul>
0N/A * <li>The hash code of a primitive value <tt><i>v</i></tt> is equal to
0N/A * <tt><i>WrapperType</i>.valueOf(<i>v</i>).hashCode()</tt>, where
0N/A * <tt><i>WrapperType</i></tt> is the wrapper type corresponding
0N/A * to the primitive type of <tt><i>v</i></tt> ({@link Byte},
0N/A * {@link Character}, {@link Double}, {@link Float}, {@link Integer},
0N/A * {@link Long}, {@link Short}, or {@link Boolean}).
0N/A *
0N/A * <li>The hash code of a string, enum, class, or annotation member-value
0N/A I <tt><i>v</i></tt> is computed as by calling
0N/A * <tt><i>v</i>.hashCode()</tt>. (In the case of annotation
0N/A * member values, this is a recursive definition.)
0N/A *
0N/A * <li>The hash code of an array member-value is computed by calling
0N/A * the appropriate overloading of
0N/A * {@link java.util.Arrays#hashCode(long[]) Arrays.hashCode}
0N/A * on the value. (There is one overloading for each primitive
0N/A * type, and one for object reference types.)
0N/A * </ul>
0N/A *
0N/A * @return the hash code of this annotation
0N/A */
0N/A int hashCode();
0N/A
0N/A /**
0N/A * Returns a string representation of this annotation. The details
0N/A * of the representation are implementation-dependent, but the following
0N/A * may be regarded as typical:
0N/A * <pre>
0N/A * &#064;com.acme.util.Name(first=Alfred, middle=E., last=Neuman)
0N/A * </pre>
0N/A *
0N/A * @return a string representation of this annotation
0N/A */
0N/A String toString();
0N/A
0N/A /**
0N/A * Returns the annotation type of this annotation.
0N/A */
0N/A Class<? extends Annotation> annotationType();
0N/A}