KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > axi > Attribute


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.xml.axi;
20
21 import org.netbeans.modules.xml.axi.datatype.Datatype;
22 import org.netbeans.modules.xml.axi.datatype.StringType;
23 import org.netbeans.modules.xml.axi.impl.DatatypeBuilder;
24 import org.netbeans.modules.xml.axi.visitor.AXIVisitor;
25 import org.netbeans.modules.xml.schema.model.Form;
26 import org.netbeans.modules.xml.schema.model.SchemaComponent;
27 import org.netbeans.modules.xml.schema.model.Attribute.Use;
28
29 /**
30  * Represents an attribute in XML Schema.
31  *
32  * @author Samaresh (Samaresh.Panda@Sun.Com)
33  */

34 public abstract class Attribute extends AbstractAttribute implements AXIType {
35     
36     /**
37      * Creates a new instance of Attribute
38      */

39     public Attribute(AXIModel model) {
40         super(model);
41     }
42     
43     /**
44      * Creates a new instance of Attribute
45      */

46     public Attribute(AXIModel model, SchemaComponent schemaComponent) {
47         super(model, schemaComponent);
48     }
49
50     /**
51      * Creates a proxy for this Attribute.
52      */

53     public Attribute(AXIModel model, AXIComponent sharedComponent) {
54         super(model, sharedComponent);
55     }
56     
57     /**
58      * Allows a visitor to visit this Attribute.
59      */

60     public void accept(AXIVisitor visitor) {
61         visitor.visit(this);
62     }
63     
64     /**
65      * Returns true if it is a reference, false otherwise.
66      */

67     public abstract boolean isReference();
68     
69     /**
70      * Returns the referent if isReference() is true.
71      */

72     public abstract Attribute getReferent();
73     
74     /**
75      * Sets the name.
76      */

77     public abstract void setName(String JavaDoc name);
78         
79     /**
80      * Returns the type. This is expensive, since it uses a visitor
81      * to traverse to obtain the type information.
82      */

83     public abstract AXIType getType();
84     
85     /**
86      * Sets the type.
87      */

88     public abstract void setType(AXIType type);
89         
90     /**
91      * Returns the form.
92      */

93     public abstract Form getForm();
94     
95     /**
96      * Sets the form.
97      */

98     public abstract void setForm(Form form);
99     
100     /**
101      * Returns the fixed value.
102      */

103     public abstract String JavaDoc getFixed();
104     
105     /**
106      * Sets the fixed value.
107      */

108     public abstract void setFixed(String JavaDoc value);
109     
110     /**
111      * Returns the default value.
112      */

113     public abstract String JavaDoc getDefault();
114     
115     /**
116      * Sets the default value.
117      */

118     public abstract void setDefault(String JavaDoc value);
119     
120     /**
121      * Returns the use.
122      */

123     public abstract Use getUse();
124     
125     /**
126      * Sets the use.
127      */

128     public abstract void setUse(Use use);
129         
130     /**
131      * Returns the string representation of this Attribute.
132      */

133     public String JavaDoc toString() {
134         return getName(); //NOI18N
135
}
136     
137     ////////////////////////////////////////////////////////////////////
138
////////////////////////// member variables ////////////////////////
139
////////////////////////////////////////////////////////////////////
140
protected String JavaDoc name;
141     protected Form form;
142     protected Use use;
143     protected String JavaDoc defaultValue;
144     protected String JavaDoc fixedValue;
145     protected AXIType datatype;
146
147     ////////////////////////////////////////////////////////////////////
148
////////////////// Properties for firing events ////////////////////
149
////////////////////////////////////////////////////////////////////
150
public static final String JavaDoc PROP_NAME = "name"; //NOI18N
151
public static final String JavaDoc PROP_FORM = "form"; //NOI18N
152
public static final String JavaDoc PROP_USE = "use"; //NOI18N
153
public static final String JavaDoc PROP_DEFAULT = "default"; //NOI18N
154
public static final String JavaDoc PROP_FIXED = "fixed"; //NOI18N
155
public static final String JavaDoc PROP_TYPE = "type"; //NOI18N
156
public static final String JavaDoc PROP_ATTRIBUTE_REF = "attributeRef"; // NOI18N
157
}
158
Popular Tags