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