KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jibx > binding > model > StructureAttributes


1 /*
2 Copyright (c) 2004-2005, Dennis M. Sosnoski
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without modification,
6 are permitted provided that the following conditions are met:
7
8  * Redistributions of source code must retain the above copyright notice, this
9    list of conditions and the following disclaimer.
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  * Neither the name of JiBX nor the names of its contributors may be used
14    to endorse or promote products derived from this software without specific
15    prior written permission.
16
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */

28
29 package org.jibx.binding.model;
30
31 import org.jibx.binding.util.StringArray;
32
33 /**
34  * Model component for <b>structure</b> attribute group in binding definition.
35  *
36  * @author Dennis M. Sosnoski
37  * @version 1.0
38  */

39  
40 public class StructureAttributes extends AttributeBase
41 {
42     /** Enumeration of allowed attribute names */
43     public static final StringArray s_allowedAttributes =
44         new StringArray(new String JavaDoc[] { "label", "ordered", "using" });
45     
46     /** Flag for ordered child content. */
47     protected boolean m_isOrdered;
48     
49     /** Name for labeled child content defined elsewhere. */
50     protected String JavaDoc m_usingName;
51     
52     /** Name for labeled child content potentially referenced elsewhere. */
53     protected String JavaDoc m_labelName;
54
55     /**
56      * Constructor.
57      */

58     
59     public StructureAttributes() {
60         m_isOrdered = true;
61     }
62
63     /**
64      * Check if child components are ordered.
65      *
66      * @return <code>true</code> if ordered, <code>false</code> if not
67      */

68
69     public boolean isOrdered() {
70         return m_isOrdered;
71     }
72     
73     /**
74      * Set child components ordered flag.
75      *
76      * @param ordered <code>true</code> if ordered, <code>false</code> if not
77      */

78     
79     public void setOrdered(boolean ordered) {
80         m_isOrdered = ordered;
81     }
82     
83     /**
84      * Get name for child component list definition.
85      *
86      * @return text of name defining child components (<code>null</code> if
87      * none)
88      */

89     
90     public String JavaDoc getUsingName() {
91         return m_usingName;
92     }
93     
94     /**
95      * Set name for child component list definition.
96      *
97      * @param name text of name defining child components (<code>null</code> if
98      * none)
99      */

100     
101     public void setUsingName(String JavaDoc name) {
102         m_usingName = name;
103     }
104     
105     /**
106      * Get label name for child component list.
107      *
108      * @return label name text (<code>null</code> if none)
109      */

110     
111     public String JavaDoc getLabelName() {
112         return m_labelName;
113     }
114     
115     /**
116      * Set label name for child component list.
117      *
118      * @param name label text for name (<code>null</code> if none)
119      */

120     
121     public void setLabelName(String JavaDoc name) {
122         m_labelName = name;
123     }
124     
125     /* (non-Javadoc)
126      * @see org.jibx.binding.model.AttributeBase#prevalidate(org.jibx.binding.model.ValidationContext)
127      */

128     public void prevalidate(ValidationContext vctx) {
129         // TODO change to using templates, handle as appropriate
130
super.prevalidate(vctx);
131     }
132 }
Popular Tags