01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.woody.event;
18:
19: import java.util.Iterator;
20: import java.util.List;
21: import java.util.Map;
22:
23: import org.apache.commons.lang.enums.ValuedEnum;
24:
25: /**
26: * Type-safe enumeration of the various form processing phases.
27: *
28: * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a>
29: * @version CVS $Id: ProcessingPhase.java 433543 2006-08-22 06:22:54Z crossley $
30: */
31: public class ProcessingPhase extends ValuedEnum {
32:
33: protected ProcessingPhase(String name, int value) {
34: super (name, value);
35: }
36:
37: public static final int LOAD_MODEL_VALUE = 0;
38: public static final ProcessingPhase LOAD_MODEL = new ProcessingPhase(
39: "Load model", LOAD_MODEL_VALUE);
40:
41: public static final int READ_FROM_REQUEST_VALUE = 1;
42: public static final ProcessingPhase READ_FROM_REQUEST = new ProcessingPhase(
43: "Read from request", READ_FROM_REQUEST_VALUE);
44:
45: public static final int VALIDATE_VALUE = 2;
46: public static final ProcessingPhase VALIDATE = new ProcessingPhase(
47: "Validate", VALIDATE_VALUE);
48:
49: public static final int SAVE_MODEL_VALUE = 3;
50: public static final ProcessingPhase SAVE_MODEL = new ProcessingPhase(
51: "Save model", SAVE_MODEL_VALUE);
52:
53: public static ProcessingPhase getEnum(String name) {
54: return (ProcessingPhase) getEnum(ProcessingPhase.class, name);
55: }
56:
57: public static ProcessingPhase getEnum(int value) {
58: return (ProcessingPhase) getEnum(ProcessingPhase.class, value);
59: }
60:
61: public static Map getEnumMap() {
62: return getEnumMap(ProcessingPhase.class);
63: }
64:
65: public static List getEnumList() {
66: return getEnumList(ProcessingPhase.class);
67: }
68:
69: public static Iterator iterator() {
70: return iterator(ProcessingPhase.class);
71: }
72: }
|