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