1 17 18 19 20 package org.apache.lenya.cms.publication; 21 22 25 public class Label { 26 private String label = null; 27 private String language = null; 28 29 34 public Label(String label) { 35 this(label, null); 36 } 37 38 44 public Label(String label, String language) { 45 this.label = label; 46 this.language = language; 47 } 48 49 54 public String getLabel() { 55 return label; 56 } 57 58 63 public void setLabel(String label) { 64 this.label = label; 65 } 66 67 72 73 public String getLanguage() { 74 return language; 75 } 76 77 80 public String toString() { 81 return getLabel() + " " + getLanguage(); 82 } 83 84 87 public boolean equals(Object obj) { 88 boolean equals = false; 89 90 if (getClass().isInstance(obj)) { 91 Label otherLabel = (Label)obj; 92 equals = 93 getLabel().equals(otherLabel.getLabel()) 94 && getLanguage().equals(otherLabel.getLanguage()); 95 } 96 97 return equals; 98 } 99 100 103 public int hashCode() { 104 return getLabel().hashCode() + getLanguage().hashCode(); 105 } 106 } 107 | Popular Tags |