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