KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > forms > event > ProcessingPhase


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

16 package org.apache.cocoon.forms.event;
17
18 import java.util.Iterator JavaDoc;
19 import java.util.List JavaDoc;
20 import java.util.Map JavaDoc;
21
22 import org.apache.commons.lang.enums.ValuedEnum;
23
24 /**
25  * Type-safe enumeration of the various form processing phases.
26  *
27  * @author <a HREF="http://www.apache.org/~sylvain/">Sylvain Wallez</a>
28  * @version $Id: ProcessingPhase.java 151179 2005-02-03 16:55:16Z tim $
29  */

30 public class ProcessingPhase extends ValuedEnum {
31
32     protected ProcessingPhase(String JavaDoc name, int value) {
33         super(name, value);
34     }
35     
36     public static final int LOAD_MODEL_VALUE = 0;
37     public static final ProcessingPhase LOAD_MODEL = new ProcessingPhase("Load model", LOAD_MODEL_VALUE);
38     
39     public static final int READ_FROM_REQUEST_VALUE = 1;
40     public static final ProcessingPhase READ_FROM_REQUEST = new ProcessingPhase("Read from request", READ_FROM_REQUEST_VALUE);
41     
42     public static final int VALIDATE_VALUE = 2;
43     public static final ProcessingPhase VALIDATE = new ProcessingPhase("Validate", VALIDATE_VALUE);
44     
45     public static final int SAVE_MODEL_VALUE = 3;
46     public static final ProcessingPhase SAVE_MODEL = new ProcessingPhase("Save model", SAVE_MODEL_VALUE);
47      
48     public static ProcessingPhase getEnum(String JavaDoc name) {
49       return (ProcessingPhase) getEnum(ProcessingPhase.class, name);
50     }
51     
52     public static ProcessingPhase getEnum(int value) {
53       return (ProcessingPhase) getEnum(ProcessingPhase.class, value);
54     }
55
56     public static Map JavaDoc getEnumMap() {
57       return getEnumMap(ProcessingPhase.class);
58     }
59  
60     public static List JavaDoc getEnumList() {
61       return getEnumList(ProcessingPhase.class);
62     }
63  
64     public static Iterator JavaDoc iterator() {
65       return iterator(ProcessingPhase.class);
66     }
67 }
68
Popular Tags