Path: blob/aarch64-shenandoah-jdk8u272-b10/langtools/src/share/classes/javax/lang/model/element/Name.java
38899 views
/*1* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.lang.model.element;2627/**28* An immutable sequence of characters. When created by the same29* implementation, objects implementing this interface must obey the30* general {@linkplain Object#equals equals contract} when compared31* with each other. Therefore, {@code Name} objects from the same32* implementation are usable in collections while {@code Name}s from33* different implementations may not work properly in collections.34*35* <p>An empty {@code Name} has a length of zero.36*37* <p>In the context of {@linkplain38* javax.annotation.processing.ProcessingEnvironment annotation39* processing}, the guarantees for "the same" implementation must40* include contexts where the {@linkplain javax.annotation.processing41* API mediated} side effects of {@linkplain42* javax.annotation.processing.Processor processors} could be visible43* to each other, including successive annotation processing44* {@linkplain javax.annotation.processing.RoundEnvironment rounds}.45*46* @author Joseph D. Darcy47* @author Scott Seligman48* @author Peter von der Ahé49* @see javax.lang.model.util.Elements#getName50* @since 1.651*/52public interface Name extends CharSequence {53/**54* Returns {@code true} if the argument represents the same55* name as {@code this}, and {@code false} otherwise.56*57* <p>Note that the identity of a {@code Name} is a function both58* of its content in terms of a sequence of characters as well as59* the implementation which created it.60*61* @param obj the object to be compared with this element62* @return {@code true} if the specified object represents the same63* name as this64* @see Element#equals65*/66boolean equals(Object obj);6768/**69* Obeys the general contract of {@link Object#hashCode Object.hashCode}.70*71* @see #equals72*/73int hashCode();7475/**76* Compares this name to the specified {@code CharSequence}. The result77* is {@code true} if and only if this name represents the same sequence78* of {@code char} values as the specified sequence.79*80* @return {@code true} if this name represents the same sequence81* of {@code char} values as the specified sequence, {@code false}82* otherwise83*84* @param cs The sequence to compare this name against85* @see String#contentEquals(CharSequence)86*/87boolean contentEquals(CharSequence cs);88}899091