001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.xml.axi.datatype;
043:
044: import java.util.List;
045: import org.netbeans.modules.xml.schema.model.Whitespace;
046:
047: /**
048: *
049: * @author Ayub Khan
050: */
051: public class CustomDatatype extends Datatype {
052:
053: private String name;
054: private Datatype base;
055:
056: /** Creates a new instance of CustomDatatype */
057: public CustomDatatype(String name) {
058: this .name = name;
059: }
060:
061: /** Creates a new instance of CustomDatatype */
062: public CustomDatatype(String name, Datatype baseType) {
063: this .name = name;
064: this .base = baseType;
065: }
066:
067: public String getName() {
068: return name;
069: }
070:
071: public void setName(String name) {
072: this .name = name;
073: }
074:
075: public Datatype getBase() {
076: return base;
077: }
078:
079: public void setBase(Datatype baseType) {
080: this .base = baseType;
081: }
082:
083: public Datatype.Kind getKind() {
084: return getBase().getKind();
085: }
086:
087: public List<Datatype.Facet> getApplicableFacets() {
088: return getBase().getApplicableFacets();
089: }
090:
091: public boolean hasFacets() {
092: return getBase().hasFacets();
093: }
094:
095: public boolean isList() {
096: return getBase().isList();
097: }
098:
099: public void setIsList(boolean b) {
100: getBase().setIsList(b);
101: }
102:
103: /*
104: * returns pattern value (this corresponds to the value of pattern facet in schema)
105: *
106: * @return pattern
107: */
108: public List<? extends String> getPatterns() {
109: return getBase().getPatterns();
110: }
111:
112: /*
113: * returns enumeration values (this corresponds to the values of enumeration facets in schema)
114: *
115: * @return enumeration
116: */
117: public List<? extends Object> getEnumerations() {
118: return getBase().getEnumerations();
119: }
120:
121: /*
122: * returns whitespace value (this corresponds to the value of whitespace facet in schema)
123: *
124: * @return whitespaces
125: */
126: public List<Whitespace.Treatment> getWhiteSpaces() {
127: return getBase().getWhiteSpaces();
128: }
129:
130: /*
131: * returns total digits value (this corresponds to the value of totalDigits facet in schema)
132: *
133: * @return totalDigits
134: */
135: public List<? extends Number> getTotalDigits() {
136: return getBase().getTotalDigits();
137: }
138:
139: /*
140: * returns fraction digits value (this corresponds to the value of fractionDigits facet in schema)
141: *
142: * @return fractionDigits
143: */
144: public List<? extends Number> getFractionDigits() {
145: return getBase().getFractionDigits();
146: }
147:
148: /*
149: * returns maximum Inclusive value (this corresponds to the value of maxInclusive facet in schema)
150: *
151: * @return maxInclusive
152: */
153: public List<? extends Object> getMaxInclusives() {
154: return getBase().getMaxInclusives();
155: }
156:
157: /*
158: * returns maximum Exclusive value (this corresponds to the value of maxExclusive facet in schema)
159: *
160: * @return maxExclusive
161: */
162: public List<? extends Object> getMaxExclusives() {
163: return getBase().getMaxExclusives();
164: }
165:
166: /*
167: * returns minimum Inclusive value (this corresponds to the value of minInclusive facet in schema)
168: *
169: * @return minInclusive
170: */
171: public List<? extends Object> getMinInclusives() {
172: return getBase().getMinInclusives();
173: }
174:
175: /*
176: * returns minExclusive value (this corresponds to the value of minExclusive facet in schema)
177: *
178: * @return minExclusive
179: */
180: public List<? extends Object> getMinExclusives() {
181: return getBase().getMinExclusives();
182: }
183:
184: /*
185: * returns length (this corresponds to the value of length facet in schema)
186: *
187: * @return length
188: */
189: public List<? extends Number> getLengths() {
190: return getBase().getLengths();
191: }
192:
193: /*
194: * returns minimum length value (this corresponds to the value of minlength facet in schema)
195: *
196: * @return minLength
197: */
198: public List<? extends Number> getMinLengths() {
199: return getBase().getMinLengths();
200: }
201:
202: /*
203: * returns maximum length value (this corresponds to the value of maxlength facet in schema)
204: *
205: * @return maxLength
206: */
207: public List<? extends Number> getMaxLengths() {
208: return getBase().getMaxLengths();
209: }
210:
211: /*
212: * set pattern value (this corresponds to the value of pattern facet in schema)
213: *
214: * @param pattern
215: */
216: public void addPattern(String pattern) {
217: getBase().addPattern(pattern);
218: }
219:
220: /*
221: * set enumeration values (this corresponds to the values of enumeration facets in schema)
222: *
223: * @param enumeration
224: */
225: public void addEnumeration(Object enumeration) {
226: getBase().addEnumeration(enumeration);
227: }
228:
229: /*
230: * set whitespace value (this corresponds to the value of whitespace facet in schema)
231: *
232: * @param whitespace
233: */
234: public void addWhitespace(Whitespace.Treatment whitespace) {
235: getBase().addWhitespace(whitespace);
236: }
237:
238: /*
239: * set total digits value (this corresponds to the value of totalDigits facet in schema)
240: *
241: * @param totalDigits
242: */
243: public void addTotalDigits(int totalDigits) {
244: getBase().addTotalDigits(totalDigits);
245: }
246:
247: /*
248: * set fraction digits value (this corresponds to the value of fractionDigits facet in schema)
249: *
250: * @param fractionDigits
251: */
252: public void addFractionDigits(int fractionDigits) {
253: getBase().addFractionDigits(fractionDigits);
254: }
255:
256: /*
257: * set maximum Inclusive value (this corresponds to the value of maxInclusive facet in schema)
258: *
259: * @param maxInclusive
260: */
261: public void addMaxInclusive(Object maxInclusive) {
262: getBase().addMaxInclusive(maxInclusive);
263: }
264:
265: /*
266: * set maximum Exclusive value (this corresponds to the value of maxExclusive facet in schema)
267: *
268: * @param maxExclusive
269: */
270: public void addMaxExclusive(Object maxExclusive) {
271: getBase().addMaxExclusive(maxExclusive);
272: }
273:
274: /*
275: * set minimum Inclusive value (this corresponds to the value of minInclusive facet in schema)
276: *
277: * @param minInclusive
278: */
279: public void addMinInclusive(Object minInclusive) {
280: getBase().addMinInclusive(minInclusive);
281: }
282:
283: /*
284: * set minExclusive value (this corresponds to the value of minExclusive facet in schema)
285: *
286: * @param minExclusive
287: */
288: public void addMinExclusive(Object minExclusive) {
289: getBase().addMinExclusive(minExclusive);
290: }
291:
292: /*
293: * set length (this corresponds to the value of length facet in schema)
294: *
295: * @param length
296: */
297: public void addLength(int length) {
298: getBase().addLength(length);
299: }
300:
301: /*
302: * set minimum length value (this corresponds to the value of minlength facet in schema)
303: *
304: * @param minLength
305: */
306: public void addMinLength(int minLength) {
307: getBase().addMinLength(minLength);
308: }
309:
310: /*
311: * set maximum length value (this corresponds to the value of maxlength facet in schema)
312: *
313: * @param maxLength
314: */
315: public void addMaxLength(int maxLength) {
316: getBase().addMaxLength(maxLength);
317: }
318:
319: public String toString() {
320: return getName();
321: }
322: }
|