01: /*
02: * The contents of this file are subject to the terms
03: * of the Common Development and Distribution License
04: * (the "License"). You may not use this file except
05: * in compliance with the License.
06: *
07: * You can obtain a copy of the license at
08: * https://jwsdp.dev.java.net/CDDLv1.0.html
09: * See the License for the specific language governing
10: * permissions and limitations under the License.
11: *
12: * When distributing Covered Code, include this CDDL
13: * HEADER in each file and include the License file at
14: * https://jwsdp.dev.java.net/CDDLv1.0.html If applicable,
15: * add the following below this CDDL HEADER, with the
16: * fields enclosed by brackets "[]" replaced with your
17: * own identifying information: Portions Copyright [yyyy]
18: * [name of copyright owner]
19: */
20: package com.sun.xml.xsom.impl;
21:
22: import com.sun.xml.xsom.XSAttributeDecl;
23: import com.sun.xml.xsom.XSSimpleType;
24: import com.sun.xml.xsom.XmlString;
25: import com.sun.xml.xsom.impl.parser.SchemaDocumentImpl;
26: import com.sun.xml.xsom.visitor.XSFunction;
27: import com.sun.xml.xsom.visitor.XSVisitor;
28: import org.xml.sax.Locator;
29:
30: public class AttributeDeclImpl extends DeclarationImpl implements
31: XSAttributeDecl, Ref.Attribute {
32: public AttributeDeclImpl(SchemaDocumentImpl owner,
33: String _targetNamespace, String _name,
34: AnnotationImpl _annon, Locator _loc,
35: ForeignAttributesImpl _fa, boolean _anonymous,
36: XmlString _defValue, XmlString _fixedValue,
37: Ref.SimpleType _type) {
38:
39: super (owner, _annon, _loc, _fa, _targetNamespace, _name,
40: _anonymous);
41:
42: if (_name == null) // assertion failed.
43: throw new IllegalArgumentException();
44:
45: this .defaultValue = _defValue;
46: this .fixedValue = _fixedValue;
47: this .type = _type;
48: }
49:
50: private final Ref.SimpleType type;
51:
52: public XSSimpleType getType() {
53: return type.getType();
54: }
55:
56: private final XmlString defaultValue;
57:
58: public XmlString getDefaultValue() {
59: return defaultValue;
60: }
61:
62: private final XmlString fixedValue;
63:
64: public XmlString getFixedValue() {
65: return fixedValue;
66: }
67:
68: public void visit(XSVisitor visitor) {
69: visitor.attributeDecl(this );
70: }
71:
72: public Object apply(XSFunction function) {
73: return function.attributeDecl(this );
74: }
75:
76: // Ref.Attribute implementation
77: public XSAttributeDecl getAttribute() {
78: return this;
79: }
80: }
|