2 * This class was automatically generated with
\r
3 * <a href="http://www.castor.org">Castor 0.9.9M2</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 java.io.IOException;
\r
15 import java.io.Reader;
\r
16 import java.io.Serializable;
\r
17 import java.io.Writer;
\r
18 import org.exolab.castor.xml.MarshalException;
\r
19 import org.exolab.castor.xml.Marshaller;
\r
20 import org.exolab.castor.xml.Unmarshaller;
\r
21 import org.exolab.castor.xml.ValidationException;
\r
22 import org.xml.sax.ContentHandler;
\r
27 * @version $Revision$ $Date$
\r
29 public class Attachment extends uk.ac.vamsas.objects.core.AppData
\r
30 implements java.io.Serializable
\r
34 //--------------------------/
\r
35 //- Class/Member Variables -/
\r
36 //--------------------------/
\r
39 * true implies data will be decompresses with Zip
\r
40 * before presenting to application
\r
42 private boolean _compressed = false;
\r
45 * keeps track of state for field: _compressed
\r
47 private boolean _has_compressed;
\r
50 * Type of arbitrary data - TODO: decide format - use
\r
51 * (extended) MIME types ?
\r
53 private java.lang.String _type;
\r
56 * Object the arbitrary data is associated with
\r
59 private java.lang.Object _objectref;
\r
62 * Primary Key for vamsas object referencing
\r
65 private java.lang.String _id;
\r
72 public Attachment()
\r
75 } //-- uk.ac.vamsas.objects.core.Attachment()
\r
83 * Method deleteCompressed
\r
86 public void deleteCompressed()
\r
88 this._has_compressed= false;
\r
89 } //-- void deleteCompressed()
\r
92 * Note: hashCode() has not been overriden
\r
97 public boolean equals(java.lang.Object obj)
\r
102 if (super.equals(obj)==false)
\r
105 if (obj instanceof Attachment) {
\r
107 Attachment temp = (Attachment)obj;
\r
108 if (this._compressed != temp._compressed)
\r
110 if (this._has_compressed != temp._has_compressed)
\r
112 if (this._type != null) {
\r
113 if (temp._type == null) return false;
\r
114 else if (!(this._type.equals(temp._type)))
\r
117 else if (temp._type != null)
\r
119 if (this._objectref != null) {
\r
120 if (temp._objectref == null) return false;
\r
121 else if (!(this._objectref.equals(temp._objectref)))
\r
124 else if (temp._objectref != null)
\r
126 if (this._id != null) {
\r
127 if (temp._id == null) return false;
\r
128 else if (!(this._id.equals(temp._id)))
\r
131 else if (temp._id != null)
\r
136 } //-- boolean equals(java.lang.Object)
\r
139 * Returns the value of field 'compressed'. The field
\r
140 * 'compressed' has the following description: true implies
\r
141 * data will be decompresses with Zip
\r
142 * before presenting to application
\r
145 * @return the value of field 'compressed'.
\r
147 public boolean getCompressed()
\r
149 return this._compressed;
\r
150 } //-- boolean getCompressed()
\r
153 * Returns the value of field 'id'. The field 'id' has the
\r
154 * following description: Primary Key for vamsas object
\r
159 * @return the value of field 'id'.
\r
161 public java.lang.String getId()
\r
164 } //-- java.lang.String getId()
\r
167 * Returns the value of field 'objectref'. The field
\r
168 * 'objectref' has the following description: Object the
\r
169 * arbitrary data is associated with
\r
173 * @return the value of field 'objectref'.
\r
175 public java.lang.Object getObjectref()
\r
177 return this._objectref;
\r
178 } //-- java.lang.Object getObjectref()
\r
181 * Returns the value of field 'type'. The field 'type' has the
\r
182 * following description: Type of arbitrary data - TODO: decide
\r
184 * (extended) MIME types ?
\r
187 * @return the value of field 'type'.
\r
189 public java.lang.String getType()
\r
192 } //-- java.lang.String getType()
\r
195 * Method hasCompressed
\r
201 public boolean hasCompressed()
\r
203 return this._has_compressed;
\r
204 } //-- boolean hasCompressed()
\r
213 public boolean isValid()
\r
218 catch (org.exolab.castor.xml.ValidationException vex) {
\r
222 } //-- boolean isValid()
\r
231 public void marshal(java.io.Writer out)
\r
232 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
\r
235 Marshaller.marshal(this, out);
\r
236 } //-- void marshal(java.io.Writer)
\r
245 public void marshal(org.xml.sax.ContentHandler handler)
\r
246 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
\r
249 Marshaller.marshal(this, handler);
\r
250 } //-- void marshal(org.xml.sax.ContentHandler)
\r
253 * Sets the value of field 'compressed'. The field 'compressed'
\r
254 * has the following description: true implies data will be
\r
255 * decompresses with Zip
\r
256 * before presenting to application
\r
258 * @param compressed the value of field 'compressed'.
\r
260 public void setCompressed(boolean compressed)
\r
262 this._compressed = compressed;
\r
263 this._has_compressed = true;
\r
264 } //-- void setCompressed(boolean)
\r
267 * Sets the value of field 'id'. The field 'id' has the
\r
268 * following description: Primary Key for vamsas object
\r
272 * @param id the value of field 'id'.
\r
274 public void setId(java.lang.String id)
\r
277 } //-- void setId(java.lang.String)
\r
280 * Sets the value of field 'objectref'. The field 'objectref'
\r
281 * has the following description: Object the arbitrary data is
\r
285 * @param objectref the value of field 'objectref'.
\r
287 public void setObjectref(java.lang.Object objectref)
\r
289 this._objectref = objectref;
\r
290 } //-- void setObjectref(java.lang.Object)
\r
293 * Sets the value of field 'type'. The field 'type' has the
\r
294 * following description: Type of arbitrary data - TODO: decide
\r
296 * (extended) MIME types ?
\r
298 * @param type the value of field 'type'.
\r
300 public void setType(java.lang.String type)
\r
303 } //-- void setType(java.lang.String)
\r
313 public static uk.ac.vamsas.objects.core.AppData unmarshal(java.io.Reader reader)
\r
314 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
\r
316 return (uk.ac.vamsas.objects.core.Attachment) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Attachment.class, reader);
\r
317 } //-- uk.ac.vamsas.objects.core.AppData unmarshal(java.io.Reader)
\r
323 public void validate()
\r
324 throws org.exolab.castor.xml.ValidationException
\r
326 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
327 validator.validate(this);
\r
328 } //-- void validate()
\r