KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jetspeed > xml > api > jcm > ImageDescriptor


1 /*
2  * This class was automatically generated with
3  * <a HREF="http://castor.exolab.org">Castor 0.9.2</a>, using an
4  * XML Schema.
5  * $Id$
6  */

7
8 package org.apache.jetspeed.xml.api.jcm;
9
10   //---------------------------------/
11
//- Imported classes and packages -/
12
//---------------------------------/
13

14 import org.exolab.castor.mapping.AccessMode;
15 import org.exolab.castor.mapping.ClassDescriptor;
16 import org.exolab.castor.mapping.FieldDescriptor;
17 import org.exolab.castor.xml.*;
18 import org.exolab.castor.xml.FieldValidator;
19 import org.exolab.castor.xml.TypeValidator;
20 import org.exolab.castor.xml.XMLFieldDescriptor;
21 import org.exolab.castor.xml.handlers.*;
22 import org.exolab.castor.xml.util.XMLFieldDescriptorImpl;
23 import org.exolab.castor.xml.validators.*;
24
25 /**
26  *
27  * @version $Revision$ $Date$
28 **/

29 public class ImageDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
30
31
32       //--------------------------/
33
//- Class/Member Variables -/
34
//--------------------------/
35

36     private java.lang.String JavaDoc nsPrefix;
37
38     private java.lang.String JavaDoc nsURI;
39
40     private java.lang.String JavaDoc xmlName;
41
42     private org.exolab.castor.xml.XMLFieldDescriptor identity;
43
44
45       //----------------/
46
//- Constructors -/
47
//----------------/
48

49     public ImageDescriptor() {
50         super();
51         nsURI = "http://jakarta.apache.org/jetspeed/xml/jetspeed-portal-content";
52         xmlName = "image";
53         XMLFieldDescriptorImpl desc = null;
54         XMLFieldHandler handler = null;
55         FieldValidator fieldValidator = null;
56         //-- initialize attribute descriptors
57

58         //-- initialize element descriptors
59

60         //-- _title
61
desc = new XMLFieldDescriptorImpl(java.lang.String JavaDoc.class, "_title", "title", NodeType.Element);
62         desc.setImmutable(true);
63         handler = (new XMLFieldHandler() {
64             public Object JavaDoc getValue( Object JavaDoc object )
65                 throws IllegalStateException JavaDoc
66             {
67                 Image target = (Image) object;
68                 return target.getTitle();
69             }
70             public void setValue( Object JavaDoc object, Object JavaDoc value)
71                 throws IllegalStateException JavaDoc, IllegalArgumentException JavaDoc
72             {
73                 try {
74                     Image target = (Image) object;
75                     target.setTitle( (java.lang.String JavaDoc) value);
76                 }
77                 catch (Exception JavaDoc ex) {
78                     throw new IllegalStateException JavaDoc(ex.toString());
79                 }
80             }
81             public Object JavaDoc newInstance( Object JavaDoc parent ) {
82                 return null;
83             }
84         } );
85         desc.setHandler(handler);
86         desc.setNameSpaceURI("http://jakarta.apache.org/jetspeed/xml/jetspeed-portal-content");
87         desc.setRequired(true);
88         desc.setMultivalued(false);
89         addFieldDescriptor(desc);
90         
91         //-- validation code for: _title
92
fieldValidator = new FieldValidator();
93         fieldValidator.setMinOccurs(1);
94         { //-- local scope
95
StringValidator sv = new StringValidator();
96             sv.setWhiteSpace("preserve");
97             fieldValidator.setValidator(sv);
98         }
99         desc.setValidator(fieldValidator);
100         
101         //-- _url
102
desc = new XMLFieldDescriptorImpl(java.lang.String JavaDoc.class, "_url", "url", NodeType.Element);
103         desc.setImmutable(true);
104         handler = (new XMLFieldHandler() {
105             public Object JavaDoc getValue( Object JavaDoc object )
106                 throws IllegalStateException JavaDoc
107             {
108                 Image target = (Image) object;
109                 return target.getUrl();
110             }
111             public void setValue( Object JavaDoc object, Object JavaDoc value)
112                 throws IllegalStateException JavaDoc, IllegalArgumentException JavaDoc
113             {
114                 try {
115                     Image target = (Image) object;
116                     target.setUrl( (java.lang.String JavaDoc) value);
117                 }
118                 catch (Exception JavaDoc ex) {
119                     throw new IllegalStateException JavaDoc(ex.toString());
120                 }
121             }
122             public Object JavaDoc newInstance( Object JavaDoc parent ) {
123                 return null;
124             }
125         } );
126         desc.setHandler(handler);
127         desc.setNameSpaceURI("http://jakarta.apache.org/jetspeed/xml/jetspeed-portal-content");
128         desc.setRequired(true);
129         desc.setMultivalued(false);
130         addFieldDescriptor(desc);
131         
132         //-- validation code for: _url
133
fieldValidator = new FieldValidator();
134         fieldValidator.setMinOccurs(1);
135         { //-- local scope
136
StringValidator sv = new StringValidator();
137             sv.setWhiteSpace("preserve");
138             fieldValidator.setValidator(sv);
139         }
140         desc.setValidator(fieldValidator);
141         
142         //-- _link
143
desc = new XMLFieldDescriptorImpl(java.lang.String JavaDoc.class, "_link", "link", NodeType.Element);
144         desc.setImmutable(true);
145         handler = (new XMLFieldHandler() {
146             public Object JavaDoc getValue( Object JavaDoc object )
147                 throws IllegalStateException JavaDoc
148             {
149                 Image target = (Image) object;
150                 return target.getLink();
151             }
152             public void setValue( Object JavaDoc object, Object JavaDoc value)
153                 throws IllegalStateException JavaDoc, IllegalArgumentException JavaDoc
154             {
155                 try {
156                     Image target = (Image) object;
157                     target.setLink( (java.lang.String JavaDoc) value);
158                 }
159                 catch (Exception JavaDoc ex) {
160                     throw new IllegalStateException JavaDoc(ex.toString());
161                 }
162             }
163             public Object JavaDoc newInstance( Object JavaDoc parent ) {
164                 return null;
165             }
166         } );
167         desc.setHandler(handler);
168         desc.setNameSpaceURI("http://jakarta.apache.org/jetspeed/xml/jetspeed-portal-content");
169         desc.setRequired(true);
170         desc.setMultivalued(false);
171         addFieldDescriptor(desc);
172         
173         //-- validation code for: _link
174
fieldValidator = new FieldValidator();
175         fieldValidator.setMinOccurs(1);
176         { //-- local scope
177
StringValidator sv = new StringValidator();
178             sv.setWhiteSpace("preserve");
179             fieldValidator.setValidator(sv);
180         }
181         desc.setValidator(fieldValidator);
182         
183         //-- _description
184
desc = new XMLFieldDescriptorImpl(java.lang.String JavaDoc.class, "_description", "description", NodeType.Element);
185         desc.setImmutable(true);
186         handler = (new XMLFieldHandler() {
187             public Object JavaDoc getValue( Object JavaDoc object )
188                 throws IllegalStateException JavaDoc
189             {
190                 Image target = (Image) object;
191                 return target.getDescription();
192             }
193             public void setValue( Object JavaDoc object, Object JavaDoc value)
194                 throws IllegalStateException JavaDoc, IllegalArgumentException JavaDoc
195             {
196                 try {
197                     Image target = (Image) object;
198                     target.setDescription( (java.lang.String JavaDoc) value);
199                 }
200                 catch (Exception JavaDoc ex) {
201                     throw new IllegalStateException JavaDoc(ex.toString());
202                 }
203             }
204             public Object JavaDoc newInstance( Object JavaDoc parent ) {
205                 return null;
206             }
207         } );
208         desc.setHandler(handler);
209         desc.setNameSpaceURI("http://jakarta.apache.org/jetspeed/xml/jetspeed-portal-content");
210         desc.setMultivalued(false);
211         addFieldDescriptor(desc);
212         
213         //-- validation code for: _description
214
fieldValidator = new FieldValidator();
215         { //-- local scope
216
StringValidator sv = new StringValidator();
217             sv.setWhiteSpace("preserve");
218             fieldValidator.setValidator(sv);
219         }
220         desc.setValidator(fieldValidator);
221         
222         //-- _width
223
desc = new XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_width", "width", NodeType.Element);
224         handler = (new XMLFieldHandler() {
225             public Object JavaDoc getValue( Object JavaDoc object )
226                 throws IllegalStateException JavaDoc
227             {
228                 Image target = (Image) object;
229                 if(!target.hasWidth())
230                     return null;
231                 return new Integer JavaDoc(target.getWidth());
232             }
233             public void setValue( Object JavaDoc object, Object JavaDoc value)
234                 throws IllegalStateException JavaDoc, IllegalArgumentException JavaDoc
235             {
236                 try {
237                     Image target = (Image) object;
238                     // if null, use delete method for optional primitives
239
if (value == null) {
240                         target.deleteWidth();
241                         return;
242                     }
243                     target.setWidth( ((Integer JavaDoc)value).intValue());
244                 }
245                 catch (Exception JavaDoc ex) {
246                     throw new IllegalStateException JavaDoc(ex.toString());
247                 }
248             }
249             public Object JavaDoc newInstance( Object JavaDoc parent ) {
250                 return null;
251             }
252         } );
253         desc.setHandler(handler);
254         desc.setNameSpaceURI("http://jakarta.apache.org/jetspeed/xml/jetspeed-portal-content");
255         desc.setMultivalued(false);
256         addFieldDescriptor(desc);
257         
258         //-- validation code for: _width
259
fieldValidator = new FieldValidator();
260         { //-- local scope
261
IntegerValidator iv = new IntegerValidator();
262             fieldValidator.setValidator(iv);
263         }
264         desc.setValidator(fieldValidator);
265         
266         //-- _height
267
desc = new XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_height", "height", NodeType.Element);
268         handler = (new XMLFieldHandler() {
269             public Object JavaDoc getValue( Object JavaDoc object )
270                 throws IllegalStateException JavaDoc
271             {
272                 Image target = (Image) object;
273                 if(!target.hasHeight())
274                     return null;
275                 return new Integer JavaDoc(target.getHeight());
276             }
277             public void setValue( Object JavaDoc object, Object JavaDoc value)
278                 throws IllegalStateException JavaDoc, IllegalArgumentException JavaDoc
279             {
280                 try {
281                     Image target = (Image) object;
282                     // if null, use delete method for optional primitives
283
if (value == null) {
284                         target.deleteHeight();
285                         return;
286                     }
287                     target.setHeight( ((Integer JavaDoc)value).intValue());
288                 }
289                 catch (Exception JavaDoc ex) {
290                     throw new IllegalStateException JavaDoc(ex.toString());
291                 }
292             }
293             public Object JavaDoc newInstance( Object JavaDoc parent ) {
294                 return null;
295             }
296         } );
297         desc.setHandler(handler);
298         desc.setNameSpaceURI("http://jakarta.apache.org/jetspeed/xml/jetspeed-portal-content");
299         desc.setMultivalued(false);
300         addFieldDescriptor(desc);
301         
302         //-- validation code for: _height
303
fieldValidator = new FieldValidator();
304         { //-- local scope
305
IntegerValidator iv = new IntegerValidator();
306             fieldValidator.setValidator(iv);
307         }
308         desc.setValidator(fieldValidator);
309         
310     } //-- org.apache.jetspeed.xml.api.jcm.ImageDescriptor()
311

312
313       //-----------/
314
//- Methods -/
315
//-----------/
316

317     /**
318     **/

319     public org.exolab.castor.mapping.AccessMode getAccessMode()
320     {
321         return null;
322     } //-- org.exolab.castor.mapping.AccessMode getAccessMode()
323

324     /**
325     **/

326     public org.exolab.castor.mapping.ClassDescriptor getExtends()
327     {
328         return null;
329     } //-- org.exolab.castor.mapping.ClassDescriptor getExtends()
330

331     /**
332     **/

333     public org.exolab.castor.mapping.FieldDescriptor getIdentity()
334     {
335         return identity;
336     } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity()
337

338     /**
339     **/

340     public java.lang.Class JavaDoc getJavaClass()
341     {
342         return org.apache.jetspeed.xml.api.jcm.Image.class;
343     } //-- java.lang.Class getJavaClass()
344

345     /**
346     **/

347     public java.lang.String JavaDoc getNameSpacePrefix()
348     {
349         return nsPrefix;
350     } //-- java.lang.String getNameSpacePrefix()
351

352     /**
353     **/

354     public java.lang.String JavaDoc getNameSpaceURI()
355     {
356         return nsURI;
357     } //-- java.lang.String getNameSpaceURI()
358

359     /**
360     **/

361     public org.exolab.castor.xml.TypeValidator getValidator()
362     {
363         return this;
364     } //-- org.exolab.castor.xml.TypeValidator getValidator()
365

366     /**
367     **/

368     public java.lang.String JavaDoc getXMLName()
369     {
370         return xmlName;
371     } //-- java.lang.String getXMLName()
372

373 }
374
Popular Tags