1 12 13 package org.eclipse.jdt.internal.compiler.apt.model; 14 15 import javax.lang.model.element.Name; 16 17 20 public class NameImpl implements Name { 21 22 private final String _name; 23 24 25 @SuppressWarnings ("unused") 26 private NameImpl() 27 { 28 _name = null; 29 } 30 31 public NameImpl(CharSequence cs) 32 { 33 _name = cs.toString(); 34 } 35 36 public NameImpl(char[] chars) 37 { 38 _name = String.valueOf(chars); 39 } 40 41 44 @Override 45 public boolean contentEquals(CharSequence cs) { 46 return _name.equals(cs.toString()); 47 } 48 49 52 @Override 53 public char charAt(int index) { 54 return _name.charAt(index); 55 } 56 57 60 @Override 61 public int length() { 62 return _name.length(); 63 } 64 65 68 @Override 69 public CharSequence subSequence(int start, int end) { 70 return _name.subSequence(start, end); 71 } 72 73 @Override 74 public String toString() { 75 return _name; 76 } 77 78 @Override 79 public int hashCode() { 80 return _name.hashCode(); 81 } 82 83 @Override 84 public boolean equals(Object obj) { 85 if (this == obj) 86 return true; 87 if (obj == null) 88 return false; 89 if (getClass() != obj.getClass()) 90 return false; 91 final NameImpl other = (NameImpl) obj; 92 return _name.equals(other._name); 93 } 94 95 } 96 | Popular Tags |