1 7 8 9 package javax.print.attribute; 10 11 import java.io.Serializable ; 12 import java.util.Locale ; 13 14 25 public abstract class TextSyntax implements Serializable , Cloneable { 26 27 private static final long serialVersionUID = -8130648736378144102L; 28 29 33 private String value; 34 35 39 private Locale locale; 40 41 52 protected TextSyntax(String value, Locale locale) { 53 this.value = verify (value); 54 this.locale = verify (locale); 55 } 56 57 private static String verify(String value) { 58 if (value == null) { 59 throw new NullPointerException (" value is null"); 60 } 61 return value; 62 } 63 64 private static Locale verify(Locale locale) { 65 if (locale == null) { 66 return Locale.getDefault(); 67 } 68 return locale; 69 } 70 71 75 public String getValue() { 76 return value; 77 } 78 79 83 public Locale getLocale() { 84 return locale; 85 } 86 87 92 public int hashCode() { 93 return value.hashCode() ^ locale.hashCode(); 94 } 95 96 117 public boolean equals(Object object) { 118 return(object != null && 119 object instanceof TextSyntax && 120 this.value.equals (((TextSyntax ) object).value) && 121 this.locale.equals (((TextSyntax ) object).locale)); 122 } 123 124 130 public String toString(){ 131 return value; 132 } 133 134 } 135 | Popular Tags |