KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cayenne > dataview > DataTypeEnum


1 /*****************************************************************
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  ****************************************************************/

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 JavaDoc UNKNOWN_TYPE_NAME = "Unknown";
39   public static final String JavaDoc OBJECT_TYPE_NAME = "Object";
40   public static final String JavaDoc STRING_TYPE_NAME = "String";
41   public static final String JavaDoc INTEGER_TYPE_NAME = "Integer";
42   public static final String JavaDoc DOUBLE_TYPE_NAME = "Double";
43   public static final String JavaDoc MONEY_TYPE_NAME = "Money";
44   public static final String JavaDoc PERCENT_TYPE_NAME = "Percent";
45   public static final String JavaDoc DATE_TYPE_NAME = "Date";
46   public static final String JavaDoc DATETIME_TYPE_NAME = "Datetime";
47   public static final String JavaDoc BOOLEAN_TYPE_NAME = "Boolean";
48   public static final String JavaDoc 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 JavaDoc name, int value) {
63     super(name, value);
64   }
65
66   public static DataTypeEnum getEnum(String JavaDoc 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 JavaDoc getEnumClass() {
87      return DataTypeEnum.class;
88    }
89
90    public Class JavaDoc getJavaClass() {
91      return null;
92    }
93 }
94
Popular Tags