35 * 36 * <p>An empty {@code Name} has a length of zero. 37 * 38 * <p>In the context of {@linkplain 39 * javax.annotation.processing.ProcessingEnvironment annotation 40 * processing}, the guarantees for "the same" implementation must 41 * include contexts where the {@linkplain javax.annotation.processing 42 * API mediated} side effects of {@linkplain 43 * javax.annotation.processing.Processor processors} could be visible 44 * to each other, including successive annotation processing 45 * {@linkplain javax.annotation.processing.RoundEnvironment rounds}. 46 * 47 * @author Joseph D. Darcy 48 * @author Scott Seligman 49 * @author Peter von der Ahé 50 * @see javax.lang.model.util.Elements#getName 51 * @since 1.6 52 */ 53 public interface Name extends CharSequence { 54 /** 55 * Returns {@code true} if the argument represents the same 56 * name as {@code this}, and {@code false} otherwise. 57 * 58 * <p>Note that the identity of a {@code Name} is a function both 59 * of its content in terms of a sequence of characters as well as 60 * the implementation which created it. 61 * 62 * @param obj the object to be compared with this element 63 * @return {@code true} if the specified object represents the same 64 * name as this 65 * @see Element#equals 66 */ 67 boolean equals(Object obj); 68 69 /** 70 * Obeys the general contract of {@link Object#hashCode Object.hashCode}. 71 * 72 * @see #equals 73 */ 74 int hashCode(); | 35 * 36 * <p>An empty {@code Name} has a length of zero. 37 * 38 * <p>In the context of {@linkplain 39 * javax.annotation.processing.ProcessingEnvironment annotation 40 * processing}, the guarantees for "the same" implementation must 41 * include contexts where the {@linkplain javax.annotation.processing 42 * API mediated} side effects of {@linkplain 43 * javax.annotation.processing.Processor processors} could be visible 44 * to each other, including successive annotation processing 45 * {@linkplain javax.annotation.processing.RoundEnvironment rounds}. 46 * 47 * @author Joseph D. Darcy 48 * @author Scott Seligman 49 * @author Peter von der Ahé 50 * @see javax.lang.model.util.Elements#getName 51 * @since 1.6 52 */ 53 public interface Name extends CharSequence { 54 /** 55 * Returns {@code true} if this is an empty name with a length of 56 * zero; returns {@code false} otherwise. 57 * @return {@code true} for an empty name and {@code false} otherwise. 58 * 59 * @implSpec Returns the result of calling {@link 60 * CharSequence#isEmpty() CharSequence.isEmpty()}. 61 * @since 16 62 */ 63 @Override 64 default boolean isEmpty() { 65 return CharSequence.super.isEmpty(); 66 } 67 68 /** 69 * Returns {@code true} if the argument represents the same 70 * name as {@code this}, and {@code false} otherwise. 71 * 72 * <p>Note that the identity of a {@code Name} is a function both 73 * of its content in terms of a sequence of characters as well as 74 * the implementation which created it. 75 * 76 * @param obj the object to be compared with this element 77 * @return {@code true} if the specified object represents the same 78 * name as this 79 * @see Element#equals 80 */ 81 boolean equals(Object obj); 82 83 /** 84 * Obeys the general contract of {@link Object#hashCode Object.hashCode}. 85 * 86 * @see #equals 87 */ 88 int hashCode(); |