1
2
3
4
5
6
7
8 package org.astrogrid.registry.beans.v10.resource.dataservice;
9
10
11
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 Format.
26 *
27 * @version $Revision: 1.2 $ $Date: 2007/01/04 16:26:25 $
28 */
29 public class Format extends org.astrogrid.common.bean.BaseBean
30 implements java.io.Serializable
31 {
32
33
34
35
36
37
38 /***
39 * internal content storage
40 */
41 private java.lang.String _content = "";
42
43 /***
44 * if true, then the content is a MIME Type
45 *
46 */
47 private boolean _isMIMEType = false;
48
49 /***
50 * keeps track of state for field: _isMIMEType
51 */
52 private boolean _has_isMIMEType;
53
54
55
56
57
58
59 public Format() {
60 super();
61 setContent("");
62 }
63
64
65
66
67
68
69 /***
70 * Method deleteIsMIMEType
71 */
72 public void deleteIsMIMEType()
73 {
74 this._has_isMIMEType= false;
75 }
76
77 /***
78 * Note: hashCode() has not been overriden
79 *
80 * @param obj
81 */
82 public boolean equals(java.lang.Object obj)
83 {
84 if ( this == obj )
85 return true;
86
87 if (super.equals(obj)==false)
88 return false;
89
90 if (obj instanceof Format) {
91
92 Format temp = (Format)obj;
93 if (this._content != null) {
94 if (temp._content == null) return false;
95 else if (!(this._content.equals(temp._content)))
96 return false;
97 }
98 else if (temp._content != null)
99 return false;
100 if (this._isMIMEType != temp._isMIMEType)
101 return false;
102 if (this._has_isMIMEType != temp._has_isMIMEType)
103 return false;
104 return true;
105 }
106 return false;
107 }
108
109 /***
110 * Returns the value of field 'content'. The field 'content'
111 * has the following description: internal content storage
112 *
113 * @return the value of field 'content'.
114 */
115 public java.lang.String getContent()
116 {
117 return this._content;
118 }
119
120 /***
121 * Returns the value of field 'isMIMEType'. The field
122 * 'isMIMEType' has the following description: if true, then
123 * the content is a MIME Type
124 *
125 *
126 * @return the value of field 'isMIMEType'.
127 */
128 public boolean getIsMIMEType()
129 {
130 return this._isMIMEType;
131 }
132
133 /***
134 * Method hasIsMIMEType
135 */
136 public boolean hasIsMIMEType()
137 {
138 return this._has_isMIMEType;
139 }
140
141 /***
142 * Method isValid
143 */
144 public boolean isValid()
145 {
146 try {
147 validate();
148 }
149 catch (org.exolab.castor.xml.ValidationException vex) {
150 return false;
151 }
152 return true;
153 }
154
155 /***
156 * Method marshal
157 *
158 * @param out
159 */
160 public void marshal(java.io.Writer out)
161 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
162 {
163
164 Marshaller.marshal(this, out);
165 }
166
167 /***
168 * Method marshal
169 *
170 * @param handler
171 */
172 public void marshal(org.xml.sax.ContentHandler handler)
173 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
174 {
175
176 Marshaller.marshal(this, handler);
177 }
178
179 /***
180 * Sets the value of field 'content'. The field 'content' has
181 * the following description: internal content storage
182 *
183 * @param content the value of field 'content'.
184 */
185 public void setContent(java.lang.String content)
186 {
187 this._content = content;
188 }
189
190 /***
191 * Sets the value of field 'isMIMEType'. The field 'isMIMEType'
192 * has the following description: if true, then the content is
193 * a MIME Type
194 *
195 *
196 * @param isMIMEType the value of field 'isMIMEType'.
197 */
198 public void setIsMIMEType(boolean isMIMEType)
199 {
200 this._isMIMEType = isMIMEType;
201 this._has_isMIMEType = true;
202 }
203
204 /***
205 * Method unmarshalFormat
206 *
207 * @param reader
208 */
209 public static org.astrogrid.registry.beans.v10.resource.dataservice.Format unmarshalFormat(java.io.Reader reader)
210 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
211 {
212 return (org.astrogrid.registry.beans.v10.resource.dataservice.Format) Unmarshaller.unmarshal(org.astrogrid.registry.beans.v10.resource.dataservice.Format.class, reader);
213 }
214
215 /***
216 * Method validate
217 */
218 public void validate()
219 throws org.exolab.castor.xml.ValidationException
220 {
221 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
222 validator.validate(this);
223 }
224
225 }