KickJava   Java API By Example, From Geeks To Geeks.

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


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 CalcTypeEnum extends ValuedEnum {
26   public static final int NO_CALC_TYPE_VALUE = 1;
27   public static final int CALC_TYPE_VALUE = 2;
28   public static final int LOOKUP_TYPE_VALUE = 3;
29
30   public static final String JavaDoc NO_CALC_TYPE_NAME = "nocalc";
31   public static final String JavaDoc CALC_TYPE_NAME = "calc";
32   public static final String JavaDoc LOOKUP_TYPE_NAME = "lookup";
33
34   public static final CalcTypeEnum NO_CALC_TYPE = new CalcTypeEnum( NO_CALC_TYPE_NAME, NO_CALC_TYPE_VALUE );
35   public static final CalcTypeEnum CALC_TYPE = new CalcTypeEnum( CALC_TYPE_NAME, CALC_TYPE_VALUE );
36   public static final CalcTypeEnum LOOKUP_TYPE = new CalcTypeEnum( LOOKUP_TYPE_NAME, LOOKUP_TYPE_VALUE );
37
38   protected CalcTypeEnum(String JavaDoc name, int value) {
39     super(name, value);
40   }
41
42   public static CalcTypeEnum getEnum(String JavaDoc calcType) {
43      return (CalcTypeEnum) getEnum(CalcTypeEnum.class, calcType);
44    }
45
46    public static CalcTypeEnum getEnum(int calcType) {
47      return (CalcTypeEnum) getEnum(CalcTypeEnum.class, calcType);
48    }
49
50    public static Map getEnumMap() {
51      return getEnumMap(CalcTypeEnum.class);
52    }
53
54    public static List getEnumList() {
55      return getEnumList(CalcTypeEnum.class);
56    }
57
58    public static Iterator iterator() {
59      return iterator(CalcTypeEnum.class);
60    }
61
62    public final Class JavaDoc getEnumClass() {
63      return CalcTypeEnum.class;
64    }
65 }
66
Popular Tags