1 19 20 package org.apache.cayenne.dataview; 21 22 import java.util.*; 23 import org.apache.commons.lang.enums.ValuedEnum; 24 25 public class DataTypeEnum extends ValuedEnum { 26 public static final int UNKNOWN_TYPE_VALUE = -1; 27 public static final int OBJECT_TYPE_VALUE = 0; 28 public static final int STRING_TYPE_VALUE = 1; 29 public static final int INTEGER_TYPE_VALUE = 2; 30 public static final int DOUBLE_TYPE_VALUE = 3; 31 public static final int MONEY_TYPE_VALUE = 4; 32 public static final int PERCENT_TYPE_VALUE = 5; 33 public static final int DATE_TYPE_VALUE = 6; 34 public static final int DATETIME_TYPE_VALUE = 7; 35 public static final int BOOLEAN_TYPE_VALUE = 9; 36 public static final int DEFAULT_TYPE_VALUE = STRING_TYPE_VALUE; 37 38 public static final String UNKNOWN_TYPE_NAME = "Unknown"; 39 public static final String OBJECT_TYPE_NAME = "Object"; 40 public static final String STRING_TYPE_NAME = "String"; 41 public static final String INTEGER_TYPE_NAME = "Integer"; 42 public static final String DOUBLE_TYPE_NAME = "Double"; 43 public static final String MONEY_TYPE_NAME = "Money"; 44 public static final String PERCENT_TYPE_NAME = "Percent"; 45 public static final String DATE_TYPE_NAME = "Date"; 46 public static final String DATETIME_TYPE_NAME = "Datetime"; 47 public static final String BOOLEAN_TYPE_NAME = "Boolean"; 48 public static final String DEFAULT_TYPE_NAME = STRING_TYPE_NAME; 49 50 public static final DataTypeEnum UNKNOWN_TYPE = new DataTypeEnum( UNKNOWN_TYPE_NAME, UNKNOWN_TYPE_VALUE ); 51 public static final DataTypeEnum OBJECT_TYPE = new DataTypeEnum( OBJECT_TYPE_NAME, OBJECT_TYPE_VALUE ); 52 public static final DataTypeEnum STRING_TYPE = new DataTypeEnum( STRING_TYPE_NAME, STRING_TYPE_VALUE ); 53 public static final DataTypeEnum INTEGER_TYPE = new DataTypeEnum( INTEGER_TYPE_NAME, INTEGER_TYPE_VALUE ); 54 public static final DataTypeEnum DOUBLE_TYPE = new DataTypeEnum( DOUBLE_TYPE_NAME, DOUBLE_TYPE_VALUE ); 55 public static final DataTypeEnum MONEY_TYPE = new DataTypeEnum( MONEY_TYPE_NAME, MONEY_TYPE_VALUE ); 56 public static final DataTypeEnum PERCENT_TYPE = new DataTypeEnum( PERCENT_TYPE_NAME, PERCENT_TYPE_VALUE ); 57 public static final DataTypeEnum DATE_TYPE = new DataTypeEnum( DATE_TYPE_NAME, DATE_TYPE_VALUE ); 58 public static final DataTypeEnum DATETIME_TYPE = new DataTypeEnum( DATETIME_TYPE_NAME, DATETIME_TYPE_VALUE ); 59 public static final DataTypeEnum BOOLEAN_TYPE = new DataTypeEnum( BOOLEAN_TYPE_NAME, BOOLEAN_TYPE_VALUE ); 60 public static final DataTypeEnum DEFAULT_TYPE = STRING_TYPE; 61 62 protected DataTypeEnum(String name, int value) { 63 super(name, value); 64 } 65 66 public static DataTypeEnum getEnum(String dataType) { 67 return (DataTypeEnum) getEnum(DataTypeEnum.class, dataType); 68 } 69 70 public static DataTypeEnum getEnum(int dataType) { 71 return (DataTypeEnum) getEnum(DataTypeEnum.class, dataType); 72 } 73 74 public static Map getEnumMap() { 75 return getEnumMap(DataTypeEnum.class); 76 } 77 78 public static List getEnumList() { 79 return getEnumList(DataTypeEnum.class); 80 } 81 82 public static Iterator iterator() { 83 return iterator(DataTypeEnum.class); 84 } 85 86 public final Class getEnumClass() { 87 return DataTypeEnum.class; 88 } 89 90 public Class getJavaClass() { 91 return null; 92 } 93 } 94 | Popular Tags |