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.reader.xmlschema.bindinfo;
27:
28: import java.util.Collection;
29: import java.util.Collections;
30:
31: import com.sun.codemodel.internal.JCodeModel;
32: import com.sun.tools.internal.xjc.reader.Ring;
33: import com.sun.tools.internal.xjc.reader.xmlschema.BGMBuilder;
34: import com.sun.xml.internal.bind.annotation.XmlLocation;
35: import com.sun.xml.internal.xsom.XSComponent;
36:
37: import org.xml.sax.Locator;
38:
39: /**
40: * Abstract partial implementation of {@link BIDeclaration}
41: *
42: * @author
43: * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
44: */
45: abstract class AbstractDeclarationImpl implements BIDeclaration {
46:
47: @Deprecated
48: // eventually delete this in favor of using JAXB
49: protected AbstractDeclarationImpl(Locator loc) {
50: this .loc = loc;
51: }
52:
53: protected AbstractDeclarationImpl() {
54: }
55:
56: @XmlLocation
57: Locator loc; // set by JAXB
58:
59: public Locator getLocation() {
60: return loc;
61: }
62:
63: protected BindInfo parent;
64:
65: public void setParent(BindInfo p) {
66: this .parent = p;
67: }
68:
69: protected final XSComponent getOwner() {
70: return parent.getOwner();
71: }
72:
73: protected final BGMBuilder getBuilder() {
74: return parent.getBuilder();
75: }
76:
77: protected final JCodeModel getCodeModel() {
78: return Ring.get(JCodeModel.class);
79: }
80:
81: private boolean isAcknowledged = false;
82:
83: public final boolean isAcknowledged() {
84: return isAcknowledged;
85: }
86:
87: public void onSetOwner() {
88: }
89:
90: public Collection<BIDeclaration> getChildren() {
91: return Collections.emptyList();
92: }
93:
94: public void markAsAcknowledged() {
95: isAcknowledged = true;
96: }
97: }
|