X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fuk%2Fac%2Fvamsas%2Fobjects%2Fcore%2FAttachment.java;fp=src%2Fuk%2Fac%2Fvamsas%2Fobjects%2Fcore%2FAttachment.java;h=7b6fcc4971a9e79236eb06355b361ce2c3c678fe;hb=ac12127b5cf22bb34b6042e543d506894164a94c;hp=d0ed365cc9f038fe17db98b59af02020dc4f0453;hpb=7a32f8e2e264be51d0b3de6a3a599c15c82c58cd;p=vamsas.git diff --git a/src/uk/ac/vamsas/objects/core/Attachment.java b/src/uk/ac/vamsas/objects/core/Attachment.java index d0ed365..7b6fcc4 100644 --- a/src/uk/ac/vamsas/objects/core/Attachment.java +++ b/src/uk/ac/vamsas/objects/core/Attachment.java @@ -1,6 +1,6 @@ /* * This class was automatically generated with - * Castor 0.9.9M2, using an XML + * Castor 1.1, using an XML * Schema. * $Id$ */ @@ -11,15 +11,8 @@ package uk.ac.vamsas.objects.core; //- Imported classes and packages -/ //---------------------------------/ -import java.io.IOException; -import java.io.Reader; -import java.io.Serializable; -import java.io.Writer; -import org.exolab.castor.xml.MarshalException; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; -import org.exolab.castor.xml.ValidationException; -import org.xml.sax.ContentHandler; /** * Class Attachment. @@ -69,10 +62,9 @@ implements java.io.Serializable //- Constructors -/ //----------------/ - public Attachment() - { + public Attachment() { super(); - } //-- uk.ac.vamsas.objects.core.Attachment() + } //-----------/ @@ -80,22 +72,20 @@ implements java.io.Serializable //-----------/ /** - * Method deleteCompressed - * */ - public void deleteCompressed() - { + public void deleteCompressed( + ) { this._has_compressed= false; - } //-- void deleteCompressed() + } /** - * Note: hashCode() has not been overriden + * Overrides the java.lang.Object.equals method. * * @param obj - * @return boolean + * @return true if the objects are equal. */ - public boolean equals(java.lang.Object obj) - { + public boolean equals( + final java.lang.Object obj) { if ( this == obj ) return true; @@ -133,7 +123,7 @@ implements java.io.Serializable return true; } return false; - } //-- boolean equals(java.lang.Object) + } /** * Returns the value of field 'compressed'. The field @@ -141,13 +131,12 @@ implements java.io.Serializable * data will be decompresses with Zip * before presenting to application * - * @return boolean - * @return the value of field 'compressed'. + * @return the value of field 'Compressed'. */ - public boolean getCompressed() - { + public boolean getCompressed( + ) { return this._compressed; - } //-- boolean getCompressed() + } /** * Returns the value of field 'id'. The field 'id' has the @@ -155,13 +144,12 @@ implements java.io.Serializable * referencing * * - * @return String - * @return the value of field 'id'. + * @return the value of field 'Id'. */ - public java.lang.String getId() - { + public java.lang.String getId( + ) { return this._id; - } //-- java.lang.String getId() + } /** * Returns the value of field 'objectref'. The field @@ -169,13 +157,12 @@ implements java.io.Serializable * arbitrary data is associated with * * - * @return Object - * @return the value of field 'objectref'. + * @return the value of field 'Objectref'. */ - public java.lang.Object getObjectref() - { + public java.lang.Object getObjectref( + ) { return this._objectref; - } //-- java.lang.Object getObjectref() + } /** * Returns the value of field 'type'. The field 'type' has the @@ -183,71 +170,109 @@ implements java.io.Serializable * format - use * (extended) MIME types ? * - * @return String - * @return the value of field 'type'. + * @return the value of field 'Type'. */ - public java.lang.String getType() - { + public java.lang.String getType( + ) { return this._type; - } //-- java.lang.String getType() + } /** - * Method hasCompressed - * + * Method hasCompressed. * - * - * @return boolean + * @return true if at least one Compressed has been added */ - public boolean hasCompressed() - { + public boolean hasCompressed( + ) { return this._has_compressed; - } //-- boolean hasCompressed() + } /** - * Method isValid + * Overrides the java.lang.Object.hashCode method. + *

+ * The following steps came from Effective Java Programming + * Language Guide by Joshua Bloch, Chapter 3 * + * @return a hash code value for the object. + */ + public int hashCode( + ) { + int result = super.hashCode(); + + long tmp; + result = 37 * result + (_compressed?0:1); + if (_type != null) { + result = 37 * result + _type.hashCode(); + } + if (_objectref != null) { + result = 37 * result + _objectref.hashCode(); + } + if (_id != null) { + result = 37 * result + _id.hashCode(); + } + + return result; + } + + /** + * Returns the value of field 'compressed'. The field + * 'compressed' has the following description: true implies + * data will be decompresses with Zip + * before presenting to application * + * @return the value of field 'Compressed'. + */ + public boolean isCompressed( + ) { + return this._compressed; + } + + /** + * Method isValid. * - * @return boolean + * @return true if this object is valid according to the schema */ - public boolean isValid() - { + public boolean isValid( + ) { try { validate(); - } - catch (org.exolab.castor.xml.ValidationException vex) { + } catch (org.exolab.castor.xml.ValidationException vex) { return false; } return true; - } //-- boolean isValid() + } /** - * Method marshal - * * * * @param out + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema */ - public void marshal(java.io.Writer out) - throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException - { - + public void marshal( + final java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { Marshaller.marshal(this, out); - } //-- void marshal(java.io.Writer) + } /** - * Method marshal - * * * * @param handler + * @throws java.io.IOException if an IOException occurs during + * marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling */ - public void marshal(org.xml.sax.ContentHandler handler) - throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException - { - + public void marshal( + final org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { Marshaller.marshal(this, handler); - } //-- void marshal(org.xml.sax.ContentHandler) + } /** * Sets the value of field 'compressed'. The field 'compressed' @@ -257,11 +282,11 @@ implements java.io.Serializable * * @param compressed the value of field 'compressed'. */ - public void setCompressed(boolean compressed) - { + public void setCompressed( + final boolean compressed) { this._compressed = compressed; this._has_compressed = true; - } //-- void setCompressed(boolean) + } /** * Sets the value of field 'id'. The field 'id' has the @@ -271,10 +296,10 @@ implements java.io.Serializable * * @param id the value of field 'id'. */ - public void setId(java.lang.String id) - { + public void setId( + final java.lang.String id) { this._id = id; - } //-- void setId(java.lang.String) + } /** * Sets the value of field 'objectref'. The field 'objectref' @@ -284,10 +309,10 @@ implements java.io.Serializable * * @param objectref the value of field 'objectref'. */ - public void setObjectref(java.lang.Object objectref) - { + public void setObjectref( + final java.lang.Object objectref) { this._objectref = objectref; - } //-- void setObjectref(java.lang.Object) + } /** * Sets the value of field 'type'. The field 'type' has the @@ -297,34 +322,38 @@ implements java.io.Serializable * * @param type the value of field 'type'. */ - public void setType(java.lang.String type) - { + public void setType( + final java.lang.String type) { this._type = type; - } //-- void setType(java.lang.String) + } /** - * Method unmarshal - * - * + * Method unmarshal. * * @param reader - * @return AppData + * @throws org.exolab.castor.xml.MarshalException if object is + * null or if any SAXException is thrown during marshaling + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema + * @return the unmarshaled uk.ac.vamsas.objects.core.AppData */ - public static uk.ac.vamsas.objects.core.AppData unmarshal(java.io.Reader reader) - throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException - { - return (uk.ac.vamsas.objects.core.Attachment) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Attachment.class, reader); - } //-- uk.ac.vamsas.objects.core.AppData unmarshal(java.io.Reader) + public static uk.ac.vamsas.objects.core.AppData unmarshal( + final java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { + return (uk.ac.vamsas.objects.core.AppData) Unmarshaller.unmarshal(uk.ac.vamsas.objects.core.Attachment.class, reader); + } /** - * Method validate * + * + * @throws org.exolab.castor.xml.ValidationException if this + * object is an invalid instance according to the schema */ - public void validate() - throws org.exolab.castor.xml.ValidationException - { + public void validate( + ) + throws org.exolab.castor.xml.ValidationException { org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); validator.validate(this); - } //-- void validate() + } }