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.tools.internal.xjc.model;
27:
28: import com.sun.tools.internal.xjc.model.nav.NClass;
29: import com.sun.tools.internal.xjc.model.nav.NType;
30: import com.sun.xml.internal.bind.v2.model.core.EnumConstant;
31:
32: import org.xml.sax.Locator;
33:
34: /**
35: * Enumeration constant.
36: *
37: * @author Kohsuke Kawaguchi
38: */
39: public final class CEnumConstant implements EnumConstant<NType, NClass> {
40: /** Name of the constant. */
41: public final String name;
42: /** Javadoc comment. Can be null. */
43: public final String javadoc;
44: /** Lexical representation of this enum constant. Always non-null. */
45: private final String lexical;
46:
47: private CEnumLeafInfo parent;
48:
49: private final Locator locator;
50:
51: /**
52: * @param name
53: */
54: public CEnumConstant(String name, String javadoc, String lexical,
55: Locator loc) {
56: assert name != null;
57: this .name = name;
58: this .javadoc = javadoc;
59: this .lexical = lexical;
60: this .locator = loc;
61: }
62:
63: public CEnumLeafInfo getEnclosingClass() {
64: return parent;
65: }
66:
67: /*package*/void setParent(CEnumLeafInfo parent) {
68: this .parent = parent;
69: }
70:
71: public String getLexicalValue() {
72: return lexical;
73: }
74:
75: public String getName() {
76: return name;
77: }
78:
79: public Locator getLocator() {
80: return locator;
81: }
82: }
|