Thu, 31 Aug 2017 15:18:52 +0800
merge
1 /*
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
26 package com.sun.xml.internal.bind.v2.model.core;
28 import javax.xml.bind.annotation.XmlEnumValue;
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> {
50 /**
51 * Gets the {@link EnumLeafInfo} to which this constant belongs to.
52 *
53 * @return never null.
54 */
55 EnumLeafInfo<T,C> getEnclosingClass();
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();
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 }