01: /*
02: * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
03: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04: *
05: * This code is free software; you can redistribute it and/or modify it
06: * under the terms of the GNU General Public License version 2 only, as
07: * published by the Free Software Foundation. Sun designates this
08: * particular file as subject to the "Classpath" exception as provided
09: * by Sun in the LICENSE file that accompanied this code.
10: *
11: * This code is distributed in the hope that it will be useful, but WITHOUT
12: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14: * version 2 for more details (a copy is included in the LICENSE file that
15: * accompanied this code).
16: *
17: * You should have received a copy of the GNU General Public License version
18: * 2 along with this work; if not, write to the Free Software Foundation,
19: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20: *
21: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22: * CA 95054 USA or visit www.sun.com if you need additional information or
23: * have any questions.
24: */
25:
26: package com.sun.xml.internal.bind.v2.model.core;
27:
28: import javax.xml.bind.annotation.XmlEnumValue;
29:
30: /**
31: * Individual constant of an enumeration.
32: *
33: * <p>
34: * Javadoc in this class uses the following sample to explain the semantics:
35: * <pre>
36: * @XmlEnum(Integer.class)
37: * enum Foo {
38: * @XmlEnumValue("1")
39: * ONE,
40: * @XmlEnumValue("2")
41: * TWO
42: * }
43: * </pre>
44: *
45: * @see EnumLeafInfo
46: * @author Kohsuke Kawaguchi
47: */
48: public interface EnumConstant<T, C> {
49:
50: /**
51: * Gets the {@link EnumLeafInfo} to which this constant belongs to.
52: *
53: * @return never null.
54: */
55: EnumLeafInfo<T, C> getEnclosingClass();
56:
57: /**
58: * Lexical value of this constant.
59: *
60: * <p>
61: * This value should be evaluated against
62: * {@link EnumLeafInfo#getBaseType()} to obtain the typed value.
63: *
64: * <p>
65: * This is the same value as written in the {@link XmlEnumValue} annotation.
66: * In the above example, this method returns "1" and "2".
67: *
68: * @return
69: * never null.
70: */
71: String getLexicalValue();
72:
73: /**
74: * Gets the constant name.
75: *
76: * <p>
77: * In the above example this method return "ONE" and "TWO".
78: *
79: * @return
80: * never null. A valid Java identifier.
81: */
82: String getName();
83: }
|