1 23 package org.mdarad.framework.resources; 24 25 import java.util.Locale ; 26 27 34 public class ResourceElement implements ResourceMapped { 35 36 40 public ResourceElement(String bundle, String key, Locale locale) { 41 super(); 42 setBundle(bundle); 43 setKey(key); 44 setLocale(locale); 45 } 46 47 50 private Locale locale = Locale.getDefault(); 51 52 public Locale getLocale() { 53 return locale; 54 } 55 56 public void setLocale(Locale locale) { 57 if (locale != null) { 58 this.locale = locale; 59 } 60 } 61 62 66 private String bundle; 67 68 public String getBundle() { 69 return bundle; 70 } 71 72 public void setBundle(String bundle) { 73 this.bundle = bundle; 74 75 } 76 77 80 private String key; 81 82 public String getKey() { 83 return key; 84 } 85 86 public void setKey(String key) { 87 this.key = key; 88 } 89 90 95 public String getLabel() { 96 return ResourcesUtils.getMessage(getBundle(), getKey(), getLocale()); 97 } 98 99 106 public boolean equals(Object obj) { 107 if (!(obj instanceof ResourceElement)) { 108 throw new IllegalArgumentException ("The object to be compared " + 109 "should be a instance of " + ResourceElement.class.getName()); 110 } 111 112 ResourceElement rsrcElmnt = (ResourceElement) obj; 113 return getKey().equals(rsrcElmnt.getKey()); 114 } 115 } | Popular Tags |