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

Print this page
rev 815 : 6327048: Enum javadoc could link to JLS
6653154: Exception message for bad Enum.valueOf has spurious "class"
Reviewed-by: emcmanus
   1 /*
   2  * Copyright 2003-2004 Sun Microsystems, Inc.  All Rights Reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Sun designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Sun in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  22  * CA 95054 USA or visit www.sun.com if you need additional information or
  23  * have any 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  * @author  Josh Bloch
  35  * @since   1.5
  36  */
  37 public interface Annotation {
  38     /**
  39      * Returns true if the specified object represents an annotation
  40      * that is logically equivalent to this one.  In other words,
  41      * returns true if the specified object is an instance of the same
  42      * annotation type as this instance, all of whose members are equal
  43      * to the corresponding member of this annotation, as defined below:
  44      * <ul>
  45      *    <li>Two corresponding primitive typed members whose values are
  46      *    <tt>x</tt> and <tt>y</tt> are considered equal if <tt>x == y</tt>,
  47      *    unless their type is <tt>float</tt> or <tt>double</tt>.
  48      *
  49      *    <li>Two corresponding <tt>float</tt> members whose values
  50      *    are <tt>x</tt> and <tt>y</tt> are considered equal if
  51      *    <tt>Float.valueOf(x).equals(Float.valueOf(y))</tt>.
  52      *    (Unlike the <tt>==</tt> operator, NaN is considered equal
  53      *    to itself, and <tt>0.0f</tt> unequal to <tt>-0.0f</tt>.)


   1 /*
   2  * Copyright 2003-2009 Sun Microsystems, Inc.  All Rights Reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Sun designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Sun in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  22  * CA 95054 USA or visit www.sun.com if you need additional information or
  23  * have any 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 <i>The
  35  * Java&trade; Language Specification, Third Edition</i>, <a
  36  * href="http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html#9.6">&sect;9.6</a>.
  37  *
  38  * @author  Josh Bloch
  39  * @since   1.5
  40  */
  41 public interface Annotation {
  42     /**
  43      * Returns true if the specified object represents an annotation
  44      * that is logically equivalent to this one.  In other words,
  45      * returns true if the specified object is an instance of the same
  46      * annotation type as this instance, all of whose members are equal
  47      * to the corresponding member of this annotation, as defined below:
  48      * <ul>
  49      *    <li>Two corresponding primitive typed members whose values are
  50      *    <tt>x</tt> and <tt>y</tt> are considered equal if <tt>x == y</tt>,
  51      *    unless their type is <tt>float</tt> or <tt>double</tt>.
  52      *
  53      *    <li>Two corresponding <tt>float</tt> members whose values
  54      *    are <tt>x</tt> and <tt>y</tt> are considered equal if
  55      *    <tt>Float.valueOf(x).equals(Float.valueOf(y))</tt>.
  56      *    (Unlike the <tt>==</tt> operator, NaN is considered equal
  57      *    to itself, and <tt>0.0f</tt> unequal to <tt>-0.0f</tt>.)