1 /*
2 * Copyright 2007 Assaf Arkin, Keith Visco, Ralf Joachim
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
6 * the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
14 * the License.
15 */
16 package org.exolab.castor.builder.types;
17
18 import org.exolab.javasource.JSourceCode;
19
20 /**
21 * A list type.
22 *
23 * @author <a href="mailto:arkin AT intalio DOT com">Assaf Arkin</a>
24 * @author <a href="mailto:keith AT kvisco DOT com">Keith Visco</a>
25 * @author <a href="mailto:ralf DOT joachim AT syscon DOT eu">Ralf Joachim</a>
26 * @version $Revision$ $Date: 2005-12-13 14:58:48 -0700 (Tue, 13 Dec 2005) $
27 */
28 public final class XSList extends XSListType {
29
30 /** Type number of this XSType. */
31 public static final short TYPE = XSType.COLLECTION;
32
33 /**
34 * Indicates whether this {@link XSList} instance has been created as a result
35 * of a <xs:list> definition.
36 */
37 private boolean _derivedFromXSList;
38
39 //--------------------------------------------------------------------------
40
41 /**
42 * Create a XSList.
43 *
44 * @param colType Type of collection to use.
45 * @param contentType Type of the collection members.
46 * @param useJava50 If true, the collection will be generated using Java 5
47 * features such as generics.
48 */
49 public XSList(final String colType, final XSType contentType, final boolean useJava50) {
50 super(colType, contentType, useJava50);
51 }
52
53 //--------------------------------------------------------------------------
54
55 /**
56 * {@inheritDoc}
57 */
58 public short getType() { return TYPE; }
59
60
61 //--------------------------------------------------------------------------
62
63 /**
64 * {@inheritDoc}
65 */
66 public void validationCode(final JSourceCode jsc,
67 final String fixedValue, final String validatorInstanceName) {
68 getContentType().validationCode(jsc, fixedValue, validatorInstanceName);
69 }
70
71 /**
72 * Sets whether this {@link XSList} instance has been created as a result
73 * of a <xs:list> definition.
74 * @param derivedFromXSList A boolean value, true or false.
75 */
76 public void setDerivedFromXSList(final boolean derivedFromXSList) {
77 _derivedFromXSList = derivedFromXSList;
78 }
79
80 /**
81 * Indicates whether this {@link XSList} instance has been created as a result
82 * of a <xs:list> definition.
83 * @param derivedFromXSList True if this XSList instance has been created as a result
84 * of a <xs:list> definition.
85 */
86 public boolean isDerivedFromXSList() {
87 return _derivedFromXSList;
88 }
89
90 //--------------------------------------------------------------------------
91 }