View Javadoc

1   /*
2    * This class was automatically generated with 
3    * <a href="http://www.castor.org">Castor 0.9.4.3</a>, using an XML
4    * Schema.
5    * $Id: Date.java,v 1.2 2007/01/04 16:26:24 clq2 Exp $
6    */
7   
8   package org.astrogrid.registry.beans.v10.resource;
9   
10    //---------------------------------/
11   //- Imported classes and packages -/
12  //---------------------------------/
13  
14  import java.io.IOException;
15  import java.io.Reader;
16  import java.io.Serializable;
17  import java.io.Writer;
18  import org.exolab.castor.xml.MarshalException;
19  import org.exolab.castor.xml.Marshaller;
20  import org.exolab.castor.xml.Unmarshaller;
21  import org.exolab.castor.xml.ValidationException;
22  import org.xml.sax.ContentHandler;
23  
24  /***
25   * Class Date.
26   * 
27   * @version $Revision: 1.2 $ $Date: 2007/01/04 16:26:24 $
28   */
29  public class Date extends org.astrogrid.common.bean.BaseBean 
30  implements java.io.Serializable
31  {
32  
33  
34        //--------------------------/
35       //- Class/Member Variables -/
36      //--------------------------/
37  
38      /***
39       * internal content storage
40       */
41      private org.exolab.castor.types.Date _content;
42  
43      /***
44       * A string indicating what the date refers to. 
45       *  
46       */
47      private java.lang.String _role = "representative";
48  
49  
50        //----------------/
51       //- Constructors -/
52      //----------------/
53  
54      public Date() {
55          super();
56          setRole("representative");
57      } //-- org.astrogrid.registry.beans.v10.resource.Date()
58  
59  
60        //-----------/
61       //- Methods -/
62      //-----------/
63  
64      /***
65       * Note: hashCode() has not been overriden
66       * 
67       * @param obj
68       */
69      public boolean equals(java.lang.Object obj)
70      {
71          if ( this == obj )
72              return true;
73          
74          if (super.equals(obj)==false)
75              return false;
76          
77          if (obj instanceof Date) {
78          
79              Date temp = (Date)obj;
80              if (this._content != null) {
81                  if (temp._content == null) return false;
82                  else if (!(this._content.equals(temp._content))) 
83                      return false;
84              }
85              else if (temp._content != null)
86                  return false;
87              if (this._role != null) {
88                  if (temp._role == null) return false;
89                  else if (!(this._role.equals(temp._role))) 
90                      return false;
91              }
92              else if (temp._role != null)
93                  return false;
94              return true;
95          }
96          return false;
97      } //-- boolean equals(java.lang.Object) 
98  
99      /***
100      * Returns the value of field 'content'. The field 'content'
101      * has the following description: internal content storage
102      * 
103      * @return the value of field 'content'.
104      */
105     public org.exolab.castor.types.Date getContent()
106     {
107         return this._content;
108     } //-- org.exolab.castor.types.Date getContent() 
109 
110     /***
111      * Returns the value of field 'role'. The field 'role' has the
112      * following description: A string indicating what the date
113      * refers to. 
114      *  
115      * 
116      * @return the value of field 'role'.
117      */
118     public java.lang.String getRole()
119     {
120         return this._role;
121     } //-- java.lang.String getRole() 
122 
123     /***
124      * Method isValid
125      */
126     public boolean isValid()
127     {
128         try {
129             validate();
130         }
131         catch (org.exolab.castor.xml.ValidationException vex) {
132             return false;
133         }
134         return true;
135     } //-- boolean isValid() 
136 
137     /***
138      * Method marshal
139      * 
140      * @param out
141      */
142     public void marshal(java.io.Writer out)
143         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
144     {
145         
146         Marshaller.marshal(this, out);
147     } //-- void marshal(java.io.Writer) 
148 
149     /***
150      * Method marshal
151      * 
152      * @param handler
153      */
154     public void marshal(org.xml.sax.ContentHandler handler)
155         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
156     {
157         
158         Marshaller.marshal(this, handler);
159     } //-- void marshal(org.xml.sax.ContentHandler) 
160 
161     /***
162      * Sets the value of field 'content'. The field 'content' has
163      * the following description: internal content storage
164      * 
165      * @param content the value of field 'content'.
166      */
167     public void setContent(org.exolab.castor.types.Date content)
168     {
169         this._content = content;
170     } //-- void setContent(org.exolab.castor.types.Date) 
171 
172     /***
173      * Sets the value of field 'role'. The field 'role' has the
174      * following description: A string indicating what the date
175      * refers to. 
176      *  
177      * 
178      * @param role the value of field 'role'.
179      */
180     public void setRole(java.lang.String role)
181     {
182         this._role = role;
183     } //-- void setRole(java.lang.String) 
184 
185     /***
186      * Method unmarshalDate
187      * 
188      * @param reader
189      */
190     public static org.astrogrid.registry.beans.v10.resource.Date unmarshalDate(java.io.Reader reader)
191         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
192     {
193         return (org.astrogrid.registry.beans.v10.resource.Date) Unmarshaller.unmarshal(org.astrogrid.registry.beans.v10.resource.Date.class, reader);
194     } //-- org.astrogrid.registry.beans.v10.resource.Date unmarshalDate(java.io.Reader) 
195 
196     /***
197      * Method validate
198      */
199     public void validate()
200         throws org.exolab.castor.xml.ValidationException
201     {
202         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
203         validator.validate(this);
204     } //-- void validate() 
205 
206 }