KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > lang > model > element > Name


1 /*
2  * @(#)Name.java 1.2 06/07/31
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.lang.model.element;
9
10 /**
11  * An immutable sequence of characters. When created by the same
12  * implementation, objects implementing this interface must obey the
13  * general {@linkplain Object#equals equals contract} when compared
14  * with each other. Therefore, {@code Name} objects from the same
15  * implementation are usable in collections while {@code Name}s from
16  * different implementations may not work properly in collections.
17  *
18  * <p>An empty {@code Name} has a length of zero.
19  *
20  * <p>In the context of {@linkplain
21  * javax.annotation.processing.ProcessingEnvironment annotation
22  * processing}, the guarantees for "the same" implementation must
23  * include contexts where the {@linkplain javax.annotation.processing
24  * API mediated} side effects of {@linkplain
25  * javax.annotation.processing.Processor processors} could be visible
26  * to each other, including successive annotation processing
27  * {@linkplain javax.annotation.processing.RoundEnvironment rounds}.
28  *
29  * @author Joseph D. Darcy
30  * @author Scott Seligman
31  * @author Peter von der Ah&eacute;
32  * @version 1.2 06/07/31
33  * @see javax.lang.model.util.Elements#getName
34  * @since 1.6
35  */

36 public interface Name extends CharSequence JavaDoc {
37     /**
38      * Returns {@code true} if the argument represents the same
39      * name as {@code this}, and {@code false} otherwise.
40      *
41      * <p>Note that the identity of a {@code Name} is a function both
42      * of its content in terms of a sequence of characters as well as
43      * the implementation which created it.
44      *
45      * @param obj the object to be compared with this element
46      * @return {@code true} if the specified object represents the same
47      * name as this
48      * @see Element#equals
49      */

50     boolean equals(Object JavaDoc obj);
51
52     /**
53      * Obeys the general contract of {@link Object#hashCode Object.hashCode}.
54      *
55      * @see #equals
56      */

57     int hashCode();
58
59     /**
60      * Compares this name to the specified {@code CharSequence}. The result
61      * is {@code true} if and only if this name represents the same sequence
62      * of {@code char} values as the specified sequence.
63      *
64      * @return {@code true} if this name represents the same sequence
65      * of {@code char} values as the specified sequence, {@code false}
66      * otherwise
67      *
68      * @param cs The sequence to compare this name against
69      * @see String#contentEquals(CharSequence)
70      */

71     boolean contentEquals(CharSequence JavaDoc cs);
72 }
73
Popular Tags