1 /*
2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 1.3.1</a>, using an XML
4 * Schema.
5 * $Id$
6 */
7
8 package org.exolab.castor.tests.framework.testDescriptor;
9
10 /**
11 * True if this test is expected to throw an Exception and if it
12 * would thus
13 * be an error if the test does not throw an Exception. False
14 * otherwise.
15 * <p>
16 * If FailureType is true, then this element optionally contains
17 * the attribute
18 * exception that contains the class of the Exception that is
19 * expected. If this attribute is not provided, then the presence
20 * of any
21 * exception causes the test to pass. Otherwise, the specific
22 * exception
23 * has to be thrown for the test to pass.
24 *
25 *
26 * @version $Revision$ $Date$
27 */
28 public class FailureType implements java.io.Serializable {
29
30
31 //--------------------------/
32 //- Class/Member Variables -/
33 //--------------------------/
34
35 /**
36 * internal content storage
37 */
38 private boolean _content;
39
40 /**
41 * keeps track of state for field: _content
42 */
43 private boolean _has_content;
44
45 /**
46 * Field _exception.
47 */
48 private java.lang.String _exception;
49
50 /**
51 * Field _failureStep.
52 */
53 private org.exolab.castor.tests.framework.testDescriptor.types.FailureStepType _failureStep;
54
55
56 //----------------/
57 //- Constructors -/
58 //----------------/
59
60 public FailureType() {
61 super();
62 }
63
64 public FailureType(final java.lang.String defaultValue) {
65 try {
66 setContent(new java.lang.Boolean(defaultValue).booleanValue());
67 } catch(Exception e) {
68 throw new RuntimeException("Unable to cast default value for simple content!");
69 }
70 }
71
72
73 //-----------/
74 //- Methods -/
75 //-----------/
76
77 /**
78 */
79 public void deleteContent(
80 ) {
81 this._has_content= false;
82 }
83
84 /**
85 * Returns the value of field 'content'. The field 'content'
86 * has the following description: internal content storage
87 *
88 * @return the value of field 'Content'.
89 */
90 public boolean getContent(
91 ) {
92 return this._content;
93 }
94
95 /**
96 * Returns the value of field 'exception'.
97 *
98 * @return the value of field 'Exception'.
99 */
100 public java.lang.String getException(
101 ) {
102 return this._exception;
103 }
104
105 /**
106 * Returns the value of field 'failureStep'.
107 *
108 * @return the value of field 'FailureStep'.
109 */
110 public org.exolab.castor.tests.framework.testDescriptor.types.FailureStepType getFailureStep(
111 ) {
112 return this._failureStep;
113 }
114
115 /**
116 * Method hasContent.
117 *
118 * @return true if at least one Content has been added
119 */
120 public boolean hasContent(
121 ) {
122 return this._has_content;
123 }
124
125 /**
126 * Returns the value of field 'content'. The field 'content'
127 * has the following description: internal content storage
128 *
129 * @return the value of field 'Content'.
130 */
131 public boolean isContent(
132 ) {
133 return this._content;
134 }
135
136 /**
137 * Method isValid.
138 *
139 * @return true if this object is valid according to the schema
140 */
141 public boolean isValid(
142 ) {
143 try {
144 validate();
145 } catch (org.exolab.castor.xml.ValidationException vex) {
146 return false;
147 }
148 return true;
149 }
150
151 /**
152 *
153 *
154 * @param out
155 * @throws org.exolab.castor.xml.MarshalException if object is
156 * null or if any SAXException is thrown during marshaling
157 * @throws org.exolab.castor.xml.ValidationException if this
158 * object is an invalid instance according to the schema
159 */
160 public void marshal(
161 final java.io.Writer out)
162 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
163 org.exolab.castor.xml.Marshaller.marshal(this, out);
164 }
165
166 /**
167 *
168 *
169 * @param handler
170 * @throws java.io.IOException if an IOException occurs during
171 * marshaling
172 * @throws org.exolab.castor.xml.ValidationException if this
173 * object is an invalid instance according to the schema
174 * @throws org.exolab.castor.xml.MarshalException if object is
175 * null or if any SAXException is thrown during marshaling
176 */
177 public void marshal(
178 final org.xml.sax.ContentHandler handler)
179 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
180 org.exolab.castor.xml.Marshaller.marshal(this, handler);
181 }
182
183 /**
184 * Sets the value of field 'content'. The field 'content' has
185 * the following description: internal content storage
186 *
187 * @param content the value of field 'content'.
188 */
189 public void setContent(
190 final boolean content) {
191 this._content = content;
192 this._has_content = true;
193 }
194
195 /**
196 * Sets the value of field 'exception'.
197 *
198 * @param exception the value of field 'exception'.
199 */
200 public void setException(
201 final java.lang.String exception) {
202 this._exception = exception;
203 }
204
205 /**
206 * Sets the value of field 'failureStep'.
207 *
208 * @param failureStep the value of field 'failureStep'.
209 */
210 public void setFailureStep(
211 final org.exolab.castor.tests.framework.testDescriptor.types.FailureStepType failureStep) {
212 this._failureStep = failureStep;
213 }
214
215 /**
216 * Method unmarshal.
217 *
218 * @param reader
219 * @throws org.exolab.castor.xml.MarshalException if object is
220 * null or if any SAXException is thrown during marshaling
221 * @throws org.exolab.castor.xml.ValidationException if this
222 * object is an invalid instance according to the schema
223 * @return the unmarshaled
224 * org.exolab.castor.tests.framework.testDescriptor.FailureType
225 */
226 public static org.exolab.castor.tests.framework.testDescriptor.FailureType unmarshal(
227 final java.io.Reader reader)
228 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
229 return (org.exolab.castor.tests.framework.testDescriptor.FailureType) org.exolab.castor.xml.Unmarshaller.unmarshal(org.exolab.castor.tests.framework.testDescriptor.FailureType.class, reader);
230 }
231
232 /**
233 *
234 *
235 * @throws org.exolab.castor.xml.ValidationException if this
236 * object is an invalid instance according to the schema
237 */
238 public void validate(
239 )
240 throws org.exolab.castor.xml.ValidationException {
241 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
242 validator.validate(this);
243 }
244
245 }