2 * This class was automatically generated with
\r
3 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
\r
8 package uk.ac.vamsas.objects.core;
\r
10 //---------------------------------/
\r
11 //- Imported classes and packages -/
\r
12 //---------------------------------/
\r
14 import org.exolab.castor.xml.Marshaller;
\r
15 import org.exolab.castor.xml.Unmarshaller;
\r
20 * @version $Revision$ $Date$
\r
22 public class Attachment extends uk.ac.vamsas.objects.core.AppData
\r
23 implements java.io.Serializable
\r
27 //--------------------------/
\r
28 //- Class/Member Variables -/
\r
29 //--------------------------/
\r
32 * true implies data will be decompresses with Zip
\r
33 * before presenting to application
\r
35 private boolean _compressed = false;
\r
38 * keeps track of state for field: _compressed
\r
40 private boolean _has_compressed;
\r
43 * Type of arbitrary data - TODO: decide format - use
\r
44 * (extended) MIME types ?
\r
46 private java.lang.String _type;
\r
49 * Object the arbitrary data is associated with
\r
52 private java.lang.Object _objectref;
\r
55 * Primary Key for vamsas object referencing
\r
58 private java.lang.String _id;
\r
65 public Attachment() {
\r
76 public void deleteCompressed(
\r
78 this._has_compressed= false;
\r
82 * Overrides the java.lang.Object.equals method.
\r
85 * @return true if the objects are equal.
\r
87 public boolean equals(
\r
88 final java.lang.Object obj) {
\r
92 if (super.equals(obj)==false)
\r
95 if (obj instanceof Attachment) {
\r
97 Attachment temp = (Attachment)obj;
\r
98 if (this._compressed != temp._compressed)
\r
100 if (this._has_compressed != temp._has_compressed)
\r
102 if (this._type != null) {
\r
103 if (temp._type == null) return false;
\r
104 else if (!(this._type.equals(temp._type)))
\r
107 else if (temp._type != null)
\r
109 if (this._objectref != null) {
\r
110 if (temp._objectref == null) return false;
\r
111 else if (!(this._objectref.equals(temp._objectref)))
\r
114 else if (temp._objectref != null)
\r
116 if (this._id != null) {
\r
117 if (temp._id == null) return false;
\r
118 else if (!(this._id.equals(temp._id)))
\r
121 else if (temp._id != null)
\r
129 * Returns the value of field 'compressed'. The field
\r
130 * 'compressed' has the following description: true implies
\r
131 * data will be decompresses with Zip
\r
132 * before presenting to application
\r
134 * @return the value of field 'Compressed'.
\r
136 public boolean getCompressed(
\r
138 return this._compressed;
\r
142 * Returns the value of field 'id'. The field 'id' has the
\r
143 * following description: Primary Key for vamsas object
\r
147 * @return the value of field 'Id'.
\r
149 public java.lang.String getId(
\r
155 * Returns the value of field 'objectref'. The field
\r
156 * 'objectref' has the following description: Object the
\r
157 * arbitrary data is associated with
\r
160 * @return the value of field 'Objectref'.
\r
162 public java.lang.Object getObjectref(
\r
164 return this._objectref;
\r
168 * Returns the value of field 'type'. The field 'type' has the
\r
169 * following description: Type of arbitrary data - TODO: decide
\r
171 * (extended) MIME types ?
\r
173 * @return the value of field 'Type'.
\r
175 public java.lang.String getType(
\r
181 * Method hasCompressed.
\r
183 * @return true if at least one Compressed has been added
\r
185 public boolean hasCompressed(
\r
187 return this._has_compressed;
\r
191 * Overrides the java.lang.Object.hashCode method.
\r
193 * The following steps came from <b>Effective Java Programming
\r
194 * Language Guide</b> by Joshua Bloch, Chapter 3
\r
196 * @return a hash code value for the object.
\r
198 public int hashCode(
\r
200 int result = super.hashCode();
\r
203 result = 37 * result + (_compressed?0:1);
\r
204 if (_type != null) {
\r
205 result = 37 * result + _type.hashCode();
\r
207 if (_objectref != null) {
\r
208 result = 37 * result + _objectref.hashCode();
\r
211 result = 37 * result + _id.hashCode();
\r
218 * Returns the value of field 'compressed'. The field
\r
219 * 'compressed' has the following description: true implies
\r
220 * data will be decompresses with Zip
\r
221 * before presenting to application
\r
223 * @return the value of field 'Compressed'.
\r
225 public boolean isCompressed(
\r
227 return this._compressed;
\r
233 * @return true if this object is valid according to the schema
\r
235 public boolean isValid(
\r
239 } catch (org.exolab.castor.xml.ValidationException vex) {
\r
249 * @throws org.exolab.castor.xml.MarshalException if object is
\r
250 * null or if any SAXException is thrown during marshaling
\r
251 * @throws org.exolab.castor.xml.ValidationException if this
\r
252 * object is an invalid instance according to the schema
\r
254 public void marshal(
\r
255 final java.io.Writer out)
\r
256 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
257 Marshaller.marshal(this, out);
\r
264 * @throws java.io.IOException if an IOException occurs during
\r
266 * @throws org.exolab.castor.xml.ValidationException if this
\r
267 * object is an invalid instance according to the schema
\r
268 * @throws org.exolab.castor.xml.MarshalException if object is
\r
269 * null or if any SAXException is thrown during marshaling
\r
271 public void marshal(
\r
272 final org.xml.sax.ContentHandler handler)
\r
273 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
274 Marshaller.marshal(this, handler);
\r
278 * Sets the value of field 'compressed'. The field 'compressed'
\r
279 * has the following description: true implies data will be
\r
280 * decompresses with Zip
\r
281 * before presenting to application
\r
283 * @param compressed the value of field 'compressed'.
\r
285 public void setCompressed(
\r
286 final boolean compressed) {
\r
287 this._compressed = compressed;
\r
288 this._has_compressed = true;
\r
292 * Sets the value of field 'id'. The field 'id' has the
\r
293 * following description: Primary Key for vamsas object
\r
297 * @param id the value of field 'id'.
\r
300 final java.lang.String id) {
\r
305 * Sets the value of field 'objectref'. The field 'objectref'
\r
306 * has the following description: Object the arbitrary data is
\r
310 * @param objectref the value of field 'objectref'.
\r
312 public void setObjectref(
\r
313 final java.lang.Object objectref) {
\r
314 this._objectref = objectref;
\r
318 * Sets the value of field 'type'. The field 'type' has the
\r
319 * following description: Type of arbitrary data - TODO: decide
\r
321 * (extended) MIME types ?
\r
323 * @param type the value of field 'type'.
\r
325 public void setType(
\r
326 final java.lang.String type) {
\r
331 * Method unmarshal.
\r
334 * @throws org.exolab.castor.xml.MarshalException if object is
\r
335 * null or if any SAXException is thrown during marshaling
\r
336 * @throws org.exolab.castor.xml.ValidationException if this
\r
337 * object is an invalid instance according to the schema
\r
338 * @return the unmarshaled uk.ac.vamsas.objects.core.AppData
\r
340 public static uk.ac.vamsas.objects.core.AppData unmarshal(
\r
341 final java.io.Reader reader)
\r
342 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
343 return (uk.ac.vamsas.objects.core.AppData) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Attachment.class, reader);
\r
349 * @throws org.exolab.castor.xml.ValidationException if this
\r
350 * object is an invalid instance according to the schema
\r
352 public void validate(
\r
354 throws org.exolab.castor.xml.ValidationException {
\r
355 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
356 validator.validate(this);
\r