-
- All Superinterfaces:
- CharSequence
public interface Name extends CharSequence
An immutable sequence of characters. When created by the same implementation, objects implementing this interface must obey the general equals contract when compared with each other. Therefore,Name
objects from the same implementation are usable in collections whileName
s from different implementations may not work properly in collections.An empty
Name
has a length of zero.In the context of annotation processing, the guarantees for "the same" implementation must include contexts where the API mediated side effects of processors could be visible to each other, including successive annotation processing rounds.
- Since:
- 1.6
- See Also:
Elements.getName(java.lang.CharSequence)
-
-
Method Summary
Methods Modifier and Type Method and Description boolean
contentEquals(CharSequence cs)
Compares this name to the specifiedCharSequence
.boolean
equals(Object obj)
Returnstrue
if the argument represents the same name asthis
, andfalse
otherwise.int
hashCode()
Obeys the general contract ofObject.hashCode
.-
Methods inherited from interface java.lang.CharSequence
charAt, length, subSequence, toString
-
-
-
-
Method Detail
-
equals
boolean equals(Object obj)
Returnstrue
if the argument represents the same name asthis
, andfalse
otherwise.Note that the identity of a
Name
is a function both of its content in terms of a sequence of characters as well as the implementation which created it.- Overrides:
equals
in classObject
- Parameters:
obj
- the object to be compared with this element- Returns:
true
if the specified object represents the same name as this- See Also:
Element.equals(java.lang.Object)
-
hashCode
int hashCode()
Obeys the general contract ofObject.hashCode
.- Overrides:
hashCode
in classObject
- Returns:
- a hash code value for this object.
- See Also:
equals(java.lang.Object)
-
contentEquals
boolean contentEquals(CharSequence cs)
Compares this name to the specifiedCharSequence
. The result istrue
if and only if this name represents the same sequence ofchar
values as the specified sequence.- Parameters:
cs
- The sequence to compare this name against- Returns:
true
if this name represents the same sequence ofchar
values as the specified sequence,false
otherwise- See Also:
String.contentEquals(CharSequence)
-
-
Document created the 11/06/2005, last modified the 04/03/2020
Source of the printed document:https://www.gaudry.be/en/java-api-rf-javax/lang/model/element/name.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.