import java.util.*; /** * TPA\u9069\u5fdc\u533a\u5206\u3092\u8868\u3059\u30d3\u30b8\u30cd\u30b9\u30aa\u30d6\u30b8\u30a7\u30af\u30c8 * @version $Revision$, $Date:: $ * @author */ public final class TPA_UTF8 implements Comparable { /** * \u533a\u5206\u5024(\u9069\u5fdc\u306a\u3057) */ public static final TPA_UTF8 \u9069\u5fdc\u306a\u3057; /** * \u533a\u5206\u5024(\u9069\u5fdc\u3042\u308a\u30fb\u6295\u4e0e) */ public static final TPA_UTF8 \u9069\u5fdc\u3042\u308a\u30fb\u6295\u4e0e; /** * \u533a\u5206\u5024(\u9069\u5fdc\u3042\u308a\u30fb\u6295\u4e0e\u306a\u3057) */ public static final TPA_UTF8 \u9069\u5fdc\u3042\u308a\u30fb\u6295\u4e0e\u306a\u3057; /** * \u533a\u5206\u5024(\u5224\u65ad\u4e0d\u53ef\u80fd) */ public static final TPA_UTF8 \u5224\u65ad\u4e0d\u53ef\u80fd; /** * \u533a\u5206\u5024(\u4e0d\u660e) */ public static final TPA_UTF8 \u4e0d\u660e; //\u5b9a\u7fa9\u5024\u30ea\u30b9\u30c8 private static TPA_UTF8[] definedValues; //\u5024->\u6587\u5b57\u5217\u5909\u63dbMap private static Map valueMap; //\u6587\u5b57\u5217->\u5024\u5909\u63db\u30de\u30c3\u30d7 private static Map stringMap; //\u5024->\u8868\u793a\u6587\u5b57\u5217\u5909\u63dbMap private static Map displayMap; /** * serial version UID */ private static final long serialVersionUID = 1L; //\u73fe\u8c61\u540d private static final String PHENOMENON_NAME = "TPA"; //\u5b9f\u4f53\u5024 private java.lang.Integer value; //\u6587\u5b57\u5217\u8868\u73fe private String string; //\u8868\u793a\u6587\u5b57\u5217 private String display; //hashcode private int hashValue; /** * \u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf * @param val Phenomenon\u306e\u5024 */ public TPA_UTF8(java.lang.Integer val){ if(val == null){ throw new IllegalArgumentException("Param is null."); } this.value = val; this.hashValue = val.hashCode(); } /** * \u533a\u5206\u5024\u3092\u8fd4\u3059\u3002 * @return \u533a\u5206\u5024 */ public java.lang.Integer getValue(){ return(this.value); } /** * \u5024\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u8fd4\u3059\u3002(Optional Operation) * @return \u73fe\u8c61\u304c\u5185\u90e8\u3067\u4fdd\u6301\u3057\u3066\u3044\u308b\u5024\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8 * @throws UnsupportedOperationException \u30b5\u30dd\u30fc\u30c8\u3057\u3066\u306a\u3044\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306b\u5bfe\u3057\u3066\u30e1\u30bd\u30c3\u30c9\u304c\u30b3\u30fc\u30eb\u3055\u308c\u305f */ public Object getValueObject(){ return(getValue()); } /** * \u73fe\u8c61\u540d\u3092\u8fd4\u3059\u3002 * @return \u73fe\u8c61\u540d */ public String getPhenomenonName(){ return(PHENOMENON_NAME); } /** * \u5b9a\u7fa9\u3055\u308c\u3066\u3044\u308b\u5024\u306e\u914d\u5217\u3092\u8fd4\u3059\u3002 * @return \u5b9a\u7fa9\u57df\u3092\u8868\u3059\u533a\u5206\u5024\u914d\u5217 */ public static Object[] getDefinedValues(){ return(definedValues); } /** * \u696d\u52d9\u7684\u306a\u5024\u306e\u540c\u4e00\u6027\u3092\u691c\u8a3c\u3002 * @return \u771f\u507d\u5024 */ public boolean equals(Object o){ if(this == o){ return (true); } // \u540c\u4e00\u6027\u306e\u691c\u8a3c\u306f\u533a\u5206\u5024\u306e\u76f8\u9055\u3067\u5224\u65ad if(o != null && o instanceof TPA_UTF8){ TPA_UTF8 value = (TPA_UTF8)o; if(getValue().equals(value.getValue())){ return (true); } } return (false); } /** * \u30cf\u30c3\u30b7\u30e5\u5024\u3092\u8fd4\u3059\u3002 * @return \u30cf\u30c3\u30b7\u30e5\u5024 */ public int hashCode() { return(hashValue); } /** * \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u5185\u5bb9\u3092\u6587\u5b57\u5217\u3067\u8fd4\u3059\u3002 * @return \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u6587\u5b57\u5217\u8868\u73fe */ public String toString(){ if(string == null){ string = (String)valueMap.get(getValue()); if (string == null){ throw new RuntimeException("Unknown value.:value:" + getValue()); } } return (string); } /** * \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u8868\u793a\u6587\u5b57\u5217\u3092\u8fd4\u3059\u3002 * @return \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u8868\u793a\u6587\u5b57\u5217 */ public String toDisplay(){ if(display == null){ display = (String)displayMap.get(getValue()); if (display == null){ throw new RuntimeException("Unknown value.:value:" + getValue()); } } return (display); } /** * \u6587\u5b57\u5217\u304b\u3089Object\u306b\u5909\u63db\u3059\u308b * @param s \u6587\u5b57\u5217\u8868\u73fe * @return \u6587\u5b57\u5217\u304b\u3089\u5909\u63db\u3055\u308c\u305fObject */ public static TPA_UTF8 convert(String s){ Object o = stringMap.get(s); if(o == null){ throw new RuntimeException("Fail to convert."); } return((TPA_UTF8)o); } /** * \u696d\u52d9\u7684\u306a\u5024\u3092\u6bd4\u8f03\u3059\u308b\u3002 * \u30d3\u30b8\u30cd\u30b9\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3001\u5b9f\u4f53\u5024\u306e\u3069\u3061\u3089\u3067\u3082\u6bd4\u8f03\u3067\u304d\u308b\u3002 * @param \u6bd4\u8f03\u5bfe\u8c61\u30aa\u30d6\u30b8\u30a7\u30af\u30c8 * @return \u540c\u4e00\u5024\u306a\u30890, \u5c0f\u3055\u3044\u5024\u306a\u3089-1, \u5927\u304d\u3044\u5024\u306a\u30891 */ public int compareTo(Object o){ if(o != null && getValue() != null){ if(this == o){ return(0); } // \u540c\u4e00\u6027\u306e\u691c\u8a3c\u306f\u901a\u756a\u306e\u307f\u306e\u78ba\u8a8d\u3067\u5341\u5206 if(o instanceof TPA_UTF8){ TPA_UTF8 phObj = (TPA_UTF8)o; return(getValue().compareTo(phObj.getValue())); }else if(o instanceof java.lang.Integer){ return(getValue().compareTo((java.lang.Integer)o)); }else{ return -1; } } return -1; } static{ //\u533a\u5206\u5024\u306e\u521d\u671f\u5316 \u9069\u5fdc\u306a\u3057 = new TPA_UTF8(new java.lang.Integer(1)); \u9069\u5fdc\u3042\u308a\u30fb\u6295\u4e0e = new TPA_UTF8(new java.lang.Integer(2)); \u9069\u5fdc\u3042\u308a\u30fb\u6295\u4e0e\u306a\u3057 = new TPA_UTF8(new java.lang.Integer(3)); \u5224\u65ad\u4e0d\u53ef\u80fd = new TPA_UTF8(new java.lang.Integer(4)); \u4e0d\u660e = new TPA_UTF8(new java.lang.Integer(5)); //\u5024->\u6587\u5b57\u5217\u306e\u5909\u63db\u30de\u30c3\u30d7 valueMap = new HashMap(5); valueMap.put(\u9069\u5fdc\u306a\u3057.getValue(), "\u9069\u5fdc\u306a\u3057"); valueMap.put(\u9069\u5fdc\u3042\u308a\u30fb\u6295\u4e0e.getValue(), "\u9069\u5fdc\u3042\u308a\u30fb\u6295\u4e0e"); valueMap.put(\u9069\u5fdc\u3042\u308a\u30fb\u6295\u4e0e\u306a\u3057.getValue(), "\u9069\u5fdc\u3042\u308a\u30fb\u6295\u4e0e\u306a\u3057"); valueMap.put(\u5224\u65ad\u4e0d\u53ef\u80fd.getValue(), "\u5224\u65ad\u4e0d\u53ef\u80fd"); valueMap.put(\u4e0d\u660e.getValue(), "\u4e0d\u660e"); //\u6587\u5b57\u5217->businessObject\u306e\u5909\u63db\u30de\u30c3\u30d7 stringMap = new HashMap(5); stringMap.put("\u9069\u5fdc\u306a\u3057", \u9069\u5fdc\u306a\u3057); stringMap.put("\u9069\u5fdc\u3042\u308a\u30fb\u6295\u4e0e", \u9069\u5fdc\u3042\u308a\u30fb\u6295\u4e0e); stringMap.put("\u9069\u5fdc\u3042\u308a\u30fb\u6295\u4e0e\u306a\u3057", \u9069\u5fdc\u3042\u308a\u30fb\u6295\u4e0e\u306a\u3057); stringMap.put("\u5224\u65ad\u4e0d\u53ef\u80fd", \u5224\u65ad\u4e0d\u53ef\u80fd); stringMap.put("\u4e0d\u660e", \u4e0d\u660e); //\u5024->\u8868\u793a\u6587\u5b57\u5217\u306e\u5909\u63db\u30de\u30c3\u30d7 displayMap = new HashMap(5); displayMap.put(\u9069\u5fdc\u306a\u3057.getValue(), "\u9069\u5fdc\u306a\u3057"); displayMap.put(\u9069\u5fdc\u3042\u308a\u30fb\u6295\u4e0e.getValue(), "\u9069\u5fdc\u3042\u308a\u30fb\u6295\u4e0e"); displayMap.put(\u9069\u5fdc\u3042\u308a\u30fb\u6295\u4e0e\u306a\u3057.getValue(), "\u9069\u5fdc\u3042\u308a\u30fb\u6295\u4e0e\u306a\u3057"); displayMap.put(\u5224\u65ad\u4e0d\u53ef\u80fd.getValue(), "\u5224\u65ad\u4e0d\u53ef\u80fd"); displayMap.put(\u4e0d\u660e.getValue(), "\u4e0d\u660e"); //\u5b9a\u7fa9\u57df\u914d\u5217 definedValues = new TPA_UTF8[]{ \u9069\u5fdc\u306a\u3057, \u9069\u5fdc\u3042\u308a\u30fb\u6295\u4e0e, \u9069\u5fdc\u3042\u308a\u30fb\u6295\u4e0e\u306a\u3057, \u5224\u65ad\u4e0d\u53ef\u80fd, \u4e0d\u660e, }; } }