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: BaseIdentifier.java,v 1.33 2007/01/04 16:26:31 clq2 Exp $
6    */
7   
8   package org.astrogrid.community.beans.v1;
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   * The identifier base class. Contains the name and the community
26   * 
27   * @version $Revision: 1.33 $ $Date: 2007/01/04 16:26:31 $
28   */
29  public class BaseIdentifier extends org.astrogrid.common.bean.BaseBean 
30  implements java.io.Serializable
31  {
32  
33  
34        //--------------------------/
35       //- Class/Member Variables -/
36      //--------------------------/
37  
38      /***
39       * Field _name
40       */
41      private java.lang.String _name;
42  
43      /***
44       * Field _community
45       */
46      private java.lang.String _community;
47  
48  
49        //----------------/
50       //- Constructors -/
51      //----------------/
52  
53      public BaseIdentifier() {
54          super();
55      } //-- org.astrogrid.community.beans.v1.BaseIdentifier()
56  
57  
58        //-----------/
59       //- Methods -/
60      //-----------/
61  
62      /***
63       * Note: hashCode() has not been overriden
64       * 
65       * @param obj
66       */
67      public boolean equals(java.lang.Object obj)
68      {
69          if ( this == obj )
70              return true;
71          
72          if (super.equals(obj)==false)
73              return false;
74          
75          if (obj instanceof BaseIdentifier) {
76          
77              BaseIdentifier temp = (BaseIdentifier)obj;
78              if (this._name != null) {
79                  if (temp._name == null) return false;
80                  else if (!(this._name.equals(temp._name))) 
81                      return false;
82              }
83              else if (temp._name != null)
84                  return false;
85              if (this._community != null) {
86                  if (temp._community == null) return false;
87                  else if (!(this._community.equals(temp._community))) 
88                      return false;
89              }
90              else if (temp._community != null)
91                  return false;
92              return true;
93          }
94          return false;
95      } //-- boolean equals(java.lang.Object) 
96  
97      /***
98       * Returns the value of field 'community'.
99       * 
100      * @return the value of field 'community'.
101      */
102     public java.lang.String getCommunity()
103     {
104         return this._community;
105     } //-- java.lang.String getCommunity() 
106 
107     /***
108      * Returns the value of field 'name'.
109      * 
110      * @return the value of field 'name'.
111      */
112     public java.lang.String getName()
113     {
114         return this._name;
115     } //-- java.lang.String getName() 
116 
117     /***
118      * Method isValid
119      */
120     public boolean isValid()
121     {
122         try {
123             validate();
124         }
125         catch (org.exolab.castor.xml.ValidationException vex) {
126             return false;
127         }
128         return true;
129     } //-- boolean isValid() 
130 
131     /***
132      * Method marshal
133      * 
134      * @param out
135      */
136     public void marshal(java.io.Writer out)
137         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
138     {
139         
140         Marshaller.marshal(this, out);
141     } //-- void marshal(java.io.Writer) 
142 
143     /***
144      * Method marshal
145      * 
146      * @param handler
147      */
148     public void marshal(org.xml.sax.ContentHandler handler)
149         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
150     {
151         
152         Marshaller.marshal(this, handler);
153     } //-- void marshal(org.xml.sax.ContentHandler) 
154 
155     /***
156      * Sets the value of field 'community'.
157      * 
158      * @param community the value of field 'community'.
159      */
160     public void setCommunity(java.lang.String community)
161     {
162         this._community = community;
163     } //-- void setCommunity(java.lang.String) 
164 
165     /***
166      * Sets the value of field 'name'.
167      * 
168      * @param name the value of field 'name'.
169      */
170     public void setName(java.lang.String name)
171     {
172         this._name = name;
173     } //-- void setName(java.lang.String) 
174 
175     /***
176      * Method unmarshalBaseIdentifier
177      * 
178      * @param reader
179      */
180     public static org.astrogrid.community.beans.v1.BaseIdentifier unmarshalBaseIdentifier(java.io.Reader reader)
181         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
182     {
183         return (org.astrogrid.community.beans.v1.BaseIdentifier) Unmarshaller.unmarshal(org.astrogrid.community.beans.v1.BaseIdentifier.class, reader);
184     } //-- org.astrogrid.community.beans.v1.BaseIdentifier unmarshalBaseIdentifier(java.io.Reader) 
185 
186     /***
187      * Method validate
188      */
189     public void validate()
190         throws org.exolab.castor.xml.ValidationException
191     {
192         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
193         validator.validate(this);
194     } //-- void validate() 
195 
196 }