View Javadoc
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   * A Java String.
12   *  
13   * 
14   * @version $Revision$ $Date$
15   */
16  public class StringType implements java.io.Serializable {
17  
18  
19        //--------------------------/
20       //- Class/Member Variables -/
21      //--------------------------/
22  
23      /**
24       * internal content storage
25       */
26      private java.lang.String _content = "";
27  
28  
29        //----------------/
30       //- Constructors -/
31      //----------------/
32  
33      public StringType() {
34          super();
35          setContent("");
36      }
37  
38      public StringType(final java.lang.String defaultValue) {
39          try {
40              setContent( new java.lang.String(defaultValue));
41           } catch(Exception e) {
42              throw new RuntimeException("Unable to cast default value for simple content!");
43           } 
44      }
45  
46  
47        //-----------/
48       //- Methods -/
49      //-----------/
50  
51      /**
52       * Returns the value of field 'content'. The field 'content'
53       * has the following description: internal content storage
54       * 
55       * @return the value of field 'Content'.
56       */
57      public java.lang.String getContent(
58      ) {
59          return this._content;
60      }
61  
62      /**
63       * Method isValid.
64       * 
65       * @return true if this object is valid according to the schema
66       */
67      public boolean isValid(
68      ) {
69          try {
70              validate();
71          } catch (org.exolab.castor.xml.ValidationException vex) {
72              return false;
73          }
74          return true;
75      }
76  
77      /**
78       * 
79       * 
80       * @param out
81       * @throws org.exolab.castor.xml.MarshalException if object is
82       * null or if any SAXException is thrown during marshaling
83       * @throws org.exolab.castor.xml.ValidationException if this
84       * object is an invalid instance according to the schema
85       */
86      public void marshal(
87              final java.io.Writer out)
88      throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
89          org.exolab.castor.xml.Marshaller.marshal(this, out);
90      }
91  
92      /**
93       * 
94       * 
95       * @param handler
96       * @throws java.io.IOException if an IOException occurs during
97       * marshaling
98       * @throws org.exolab.castor.xml.ValidationException if this
99       * object is an invalid instance according to the schema
100      * @throws org.exolab.castor.xml.MarshalException if object is
101      * null or if any SAXException is thrown during marshaling
102      */
103     public void marshal(
104             final org.xml.sax.ContentHandler handler)
105     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
106         org.exolab.castor.xml.Marshaller.marshal(this, handler);
107     }
108 
109     /**
110      * Sets the value of field 'content'. The field 'content' has
111      * the following description: internal content storage
112      * 
113      * @param content the value of field 'content'.
114      */
115     public void setContent(
116             final java.lang.String content) {
117         this._content = content;
118     }
119 
120     /**
121      * Method unmarshal.
122      * 
123      * @param reader
124      * @throws org.exolab.castor.xml.MarshalException if object is
125      * null or if any SAXException is thrown during marshaling
126      * @throws org.exolab.castor.xml.ValidationException if this
127      * object is an invalid instance according to the schema
128      * @return the unmarshaled
129      * org.exolab.castor.tests.framework.testDescriptor.StringType
130      */
131     public static org.exolab.castor.tests.framework.testDescriptor.StringType unmarshal(
132             final java.io.Reader reader)
133     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
134         return (org.exolab.castor.tests.framework.testDescriptor.StringType) org.exolab.castor.xml.Unmarshaller.unmarshal(org.exolab.castor.tests.framework.testDescriptor.StringType.class, reader);
135     }
136 
137     /**
138      * 
139      * 
140      * @throws org.exolab.castor.xml.ValidationException if this
141      * object is an invalid instance according to the schema
142      */
143     public void validate(
144     )
145     throws org.exolab.castor.xml.ValidationException {
146         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
147         validator.validate(this);
148     }
149 
150 }