KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ws > jaxme > generator > sg > Facet


1 /*
2  * Copyright 2003, 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  */

17 package org.apache.ws.jaxme.generator.sg;
18
19 import java.io.Serializable JavaDoc;
20
21 /**
22  * @author <a HREF="mailto:joe@ispsoft.de">Jochen Wiedmann</a>
23  */

24 public interface Facet {
25   public class Type implements Serializable JavaDoc {
26     private final String JavaDoc name;
27     Type(String JavaDoc pName) { name = pName; }
28     public String JavaDoc getName() { return name; }
29     public String JavaDoc toString() { return name; }
30     private static final Type[] instances = new Type[]{
31       ENUMERATION, FRACTION_DIGITS, LENGTH, MAX_EXCLUSIVE, MAX_INCLUSIVE,
32       MAX_LENGTH, MIN_EXCLUSIVE, MIN_INCLUSIVE, MIN_LENGTH, PATTERN, TOTAL_DIGITS
33     };
34     public static Type valueOf(String JavaDoc pName) {
35       for (int i = 0; i < instances.length; i++) {
36         if (instances[i].name.equals(pName)) {
37           return instances[i];
38         }
39       }
40       throw new IllegalArgumentException JavaDoc("Unknown facet type: " + pName);
41     }
42     public int hashCode() { return name.hashCode(); }
43     public boolean equals(Object JavaDoc o) {
44       return o != null && (o instanceof Type) && ((Type) o).name.equals(name);
45     }
46   };
47
48   /** <p>The facet type enumeration. Use the method {@link #getValues}
49    * to query for the values.</p>
50    */

51   public static final Type ENUMERATION = new Type("enumeration");
52
53   /** <p>The facet type fractionDigits. Use the method {@link #getNumValue}
54    * to query for the values.</p>
55    */

56   public static final Type FRACTION_DIGITS = new Type("fractionDigits");
57
58   /** <p>The facet type length. Use the method {@link #getNumValue}
59    * to query for the values.</p>
60    */

61   public static final Type LENGTH = new Type("length");
62
63   /** <p>The facet type maxLength. Use the method {@link #getNumValue}
64    * to query for the values.</p>
65    */

66   public static final Type MAX_LENGTH = new Type("maxLength");
67
68   /** <p>The facet type maxExclusive. Use the method {@link #getValue} to
69    * query for the value.</p>
70    */

71   public static final Type MAX_EXCLUSIVE = new Type("maxExclusive");
72
73   /** <p>The facet type maxInclusive. Use the method {@link #getValue} to
74    * query for the value.</p>
75    */

76   public static final Type MAX_INCLUSIVE = new Type("maxInclusive");
77
78   /** <p>The facet type minLength. Use the method {@link #getNumValue}
79    * to query for the values.</p>
80    */

81   public static final Type MIN_LENGTH = new Type("minLength");
82
83   /** <p>The facet type minExclusive. Use the method {@link #getValue} to
84    * query for the value.</p>
85    */

86   public static final Type MIN_EXCLUSIVE = new Type("minExclusive");
87
88   /** <p>The facet type minInclusive. Use the method {@link #getValue} to
89    * query for the value.</p>
90    */

91   public static final Type MIN_INCLUSIVE = new Type("minInclusive");
92
93   /** <p>The facet type pattern. Use the method {@link #getValues}
94    * to query for the values.</p>
95    */

96   public static final Type PATTERN = new Type("pattern");
97
98   /** <p>The facet type totalDigits. Use the method {@link #getNumValue}
99    * to query for the values.</p>
100    */

101   public static final Type TOTAL_DIGITS = new Type("totalDigits");
102
103   /** <p>Returns the facet type.</p>
104    */

105   public Type getType();
106
107   /** <p>If the facet has the types {@link #ENUMERATION} or {@link #PATTERN}:
108    * Used to fetch the possible values.</p>
109    */

110   public String JavaDoc[] getValues();
111
112   /** <p>If the facet has the types {@link #MAX_EXCLUSIVE}, {@link #MIN_EXCLUSIVE},
113    * {@link #MAX_INCLUSIVE}, or {@link #MIN_INCLUSIVE}: Returns the facet value.</p>
114    */

115   public String JavaDoc getValue();
116
117   /** <p>If the facet has the types {@link #FRACTION_DIGITS} or {@link #TOTAL_DIGITS}:
118    * Returns the facet value.</p>
119    */

120   public long getNumValue();
121 }
122
Popular Tags