src/share/classes/java/lang/annotation/Annotation.java

Print this page




  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.lang.annotation;
  27 
  28 /**
  29  * The common interface extended by all annotation types.  Note that an
  30  * interface that manually extends this one does <i>not</i> define
  31  * an annotation type.  Also note that this interface does not itself
  32  * define an annotation type.
  33  *
  34  * More information about annotation types can be found in section 9.6 of
  35  * <cite>The Java&trade; Language Specification</cite>.
  36  *




  37  * @author  Josh Bloch
  38  * @since   1.5
  39  */
  40 public interface Annotation {
  41     /**
  42      * Returns true if the specified object represents an annotation
  43      * that is logically equivalent to this one.  In other words,
  44      * returns true if the specified object is an instance of the same
  45      * annotation type as this instance, all of whose members are equal
  46      * to the corresponding member of this annotation, as defined below:
  47      * <ul>
  48      *    <li>Two corresponding primitive typed members whose values are
  49      *    <tt>x</tt> and <tt>y</tt> are considered equal if <tt>x == y</tt>,
  50      *    unless their type is <tt>float</tt> or <tt>double</tt>.
  51      *
  52      *    <li>Two corresponding <tt>float</tt> members whose values
  53      *    are <tt>x</tt> and <tt>y</tt> are considered equal if
  54      *    <tt>Float.valueOf(x).equals(Float.valueOf(y))</tt>.
  55      *    (Unlike the <tt>==</tt> operator, NaN is considered equal
  56      *    to itself, and <tt>0.0f</tt> unequal to <tt>-0.0f</tt>.)




  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.lang.annotation;
  27 
  28 /**
  29  * The common interface extended by all annotation types.  Note that an
  30  * interface that manually extends this one does <i>not</i> define
  31  * an annotation type.  Also note that this interface does not itself
  32  * define an annotation type.
  33  *
  34  * More information about annotation types can be found in section 9.6 of
  35  * <cite>The Java&trade; Language Specification</cite>.
  36  *
  37  * The {@link java.lang.reflect.AnnotatedElement} interface discusses
  38  * compatibility concerns when evolving an annotation type from being
  39  * non-repeatable to being repeatable.
  40  *
  41  * @author  Josh Bloch
  42  * @since   1.5
  43  */
  44 public interface Annotation {
  45     /**
  46      * Returns true if the specified object represents an annotation
  47      * that is logically equivalent to this one.  In other words,
  48      * returns true if the specified object is an instance of the same
  49      * annotation type as this instance, all of whose members are equal
  50      * to the corresponding member of this annotation, as defined below:
  51      * <ul>
  52      *    <li>Two corresponding primitive typed members whose values are
  53      *    <tt>x</tt> and <tt>y</tt> are considered equal if <tt>x == y</tt>,
  54      *    unless their type is <tt>float</tt> or <tt>double</tt>.
  55      *
  56      *    <li>Two corresponding <tt>float</tt> members whose values
  57      *    are <tt>x</tt> and <tt>y</tt> are considered equal if
  58      *    <tt>Float.valueOf(x).equals(Float.valueOf(y))</tt>.
  59      *    (Unlike the <tt>==</tt> operator, NaN is considered equal
  60      *    to itself, and <tt>0.0f</tt> unequal to <tt>-0.0f</tt>.)