1 23 package org.mdarad.framework.expr; 24 25 import java.io.Serializable ; 26 import java.util.Locale ; 27 28 import org.mdarad.framework.resources.ResourceMapped; 29 import org.mdarad.framework.resources.ResourcesUtils; 30 31 38 public class Operator implements Serializable , 39 ResourceMapped { 40 41 49 public Operator(String key, OperatorType type, String bundleName, Locale locale) { 50 setKey(key); 51 setType(type); 52 setLocale(locale); 53 setBundle(bundleName); 54 } 55 56 62 public Operator(String key, OperatorType type) { 63 this(key, type, "", null); 64 } 65 66 70 private String key; 71 72 76 public String getKey() { 77 return key; 78 } 79 80 84 public void setKey(String key) { 85 this.key = key; 86 } 87 88 92 private OperatorType type; 93 94 public OperatorType getType() { 95 return type; 96 } 97 98 public void setType(OperatorType type) { 99 this.type = type; 100 } 101 102 108 public String getResource(String bundleName, Locale locale) { 109 String label = ResourcesUtils.getMessage(bundleName, getKey(), locale); 110 return label; 111 112 } 113 114 118 public String getResource() { 119 return getResource(getBundle(), getLocale()); 120 } 121 122 125 private Locale locale = Locale.getDefault(); 126 127 public Locale getLocale() { 128 return locale; 129 } 130 131 public void setLocale(Locale locale) { 132 if (locale != null) { 133 this.locale = locale; 134 } 135 } 136 137 140 private String bundleName = ""; 141 142 public String getBundle() { 143 return bundleName; 144 } 145 146 public void setBundle(String bundle) { 147 this.bundleName = bundle; 148 } 149 } | Popular Tags |