Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.compiler/share/classes/javax/lang/model/element/Name.java
41161 views
1
/*
2
* Copyright (c) 2006, 2020, Oracle and/or its affiliates. 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. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle 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 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 javax.lang.model.element;
27
28
/**
29
* An immutable sequence of characters. When created by the same
30
* implementation, objects implementing this interface must obey the
31
* general {@linkplain Object#equals equals contract} when compared
32
* with each other. Therefore, {@code Name} objects from the same
33
* implementation are usable in collections while {@code Name}s from
34
* different implementations may not work properly in collections.
35
*
36
* <p id="empty_name">An {@linkplain CharSequence#isEmpty() empty}
37
* {@code Name} has a {@linkplain CharSequence#length() length} of
38
* zero.
39
*
40
* <p>In the context of {@linkplain
41
* javax.annotation.processing.ProcessingEnvironment annotation
42
* processing}, the guarantees for "the same" implementation must
43
* include contexts where the {@linkplain javax.annotation.processing
44
* API mediated} side effects of {@linkplain
45
* javax.annotation.processing.Processor processors} could be visible
46
* to each other, including successive annotation processing
47
* {@linkplain javax.annotation.processing.RoundEnvironment rounds}.
48
*
49
* @author Joseph D. Darcy
50
* @author Scott Seligman
51
* @author Peter von der Ah&eacute;
52
* @see javax.lang.model.util.Elements#getName
53
* @since 1.6
54
*/
55
public interface Name extends CharSequence {
56
/**
57
* Returns {@code true} if the argument represents the same
58
* name as {@code this}, and {@code false} otherwise.
59
*
60
* <p>Note that the identity of a {@code Name} is a function both
61
* of its content in terms of a sequence of characters as well as
62
* the implementation which created it.
63
*
64
* @param obj the object to be compared with this element
65
* @return {@code true} if the specified object represents the same
66
* name as this
67
* @see Element#equals
68
*/
69
boolean equals(Object obj);
70
71
/**
72
* Obeys the general contract of {@link Object#hashCode Object.hashCode}.
73
*
74
* @see #equals
75
*/
76
int hashCode();
77
78
/**
79
* Compares this name to the specified {@code CharSequence}. The result
80
* is {@code true} if and only if this name represents the same sequence
81
* of {@code char} values as the specified sequence.
82
*
83
* @return {@code true} if this name represents the same sequence
84
* of {@code char} values as the specified sequence, {@code false}
85
* otherwise
86
*
87
* @param cs The sequence to compare this name against
88
* @see String#contentEquals(CharSequence)
89
*/
90
boolean contentEquals(CharSequence cs);
91
}
92
93