001: /*
002: * This class was automatically generated with
003: * <a href="http://www.castor.org">Castor 1.0.2</a>, using an XML
004: * Schema.
005: * $Id: CacheTypeMappingDescriptor.java 6428 2006-11-24 11:54:22Z wguttmn $
006: */
007:
008: package org.exolab.castor.mapping.xml;
009:
010: /**
011: * Class CacheTypeMappingDescriptor.
012: *
013: * @version $Revision: 6428 $ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $
014: */
015: public class CacheTypeMappingDescriptor extends
016: org.exolab.castor.xml.util.XMLClassDescriptorImpl {
017:
018: //--------------------------/
019: //- Class/Member Variables -/
020: //--------------------------/
021:
022: /**
023: * Field elementDefinition
024: */
025: private boolean elementDefinition;
026:
027: /**
028: * Field nsPrefix
029: */
030: private java.lang.String nsPrefix;
031:
032: /**
033: * Field nsURI
034: */
035: private java.lang.String nsURI;
036:
037: /**
038: * Field xmlName
039: */
040: private java.lang.String xmlName;
041:
042: /**
043: * Field identity
044: */
045: private org.exolab.castor.xml.XMLFieldDescriptor identity;
046:
047: //----------------/
048: //- Constructors -/
049: //----------------/
050:
051: public CacheTypeMappingDescriptor() {
052: super ();
053: nsURI = "http://castor.exolab.org/";
054: xmlName = "cache-type";
055: elementDefinition = true;
056:
057: //-- set grouping compositor
058: setCompositorAsSequence();
059: org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
060: org.exolab.castor.mapping.FieldHandler handler = null;
061: org.exolab.castor.xml.FieldValidator fieldValidator = null;
062: //-- initialize attribute descriptors
063:
064: //-- _type
065: desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
066: java.lang.String.class, "_type", "type",
067: org.exolab.castor.xml.NodeType.Attribute);
068: desc.setImmutable(true);
069: handler = new org.exolab.castor.xml.XMLFieldHandler() {
070: public java.lang.Object getValue(java.lang.Object object)
071: throws IllegalStateException {
072: CacheTypeMapping target = (CacheTypeMapping) object;
073: return target.getType();
074: }
075:
076: public void setValue(java.lang.Object object,
077: java.lang.Object value)
078: throws IllegalStateException,
079: IllegalArgumentException {
080: try {
081: CacheTypeMapping target = (CacheTypeMapping) object;
082: target.setType((java.lang.String) value);
083: } catch (java.lang.Exception ex) {
084: throw new IllegalStateException(ex.toString());
085: }
086: }
087:
088: public java.lang.Object newInstance(java.lang.Object parent) {
089: return null;
090: }
091: };
092: desc.setHandler(handler);
093: desc.setMultivalued(false);
094: addFieldDescriptor(desc);
095:
096: //-- validation code for: _type
097: fieldValidator = new org.exolab.castor.xml.FieldValidator();
098: { //-- local scope
099: org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator();
100: typeValidator.setWhiteSpace("preserve");
101: fieldValidator.setValidator(typeValidator);
102: }
103: desc.setValidator(fieldValidator);
104: //-- _debug
105: desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
106: java.lang.Boolean.TYPE, "_debug", "debug",
107: org.exolab.castor.xml.NodeType.Attribute);
108: handler = new org.exolab.castor.xml.XMLFieldHandler() {
109: public java.lang.Object getValue(java.lang.Object object)
110: throws IllegalStateException {
111: CacheTypeMapping target = (CacheTypeMapping) object;
112: if (!target.hasDebug())
113: return null;
114: return (target.getDebug() ? java.lang.Boolean.TRUE
115: : java.lang.Boolean.FALSE);
116: }
117:
118: public void setValue(java.lang.Object object,
119: java.lang.Object value)
120: throws IllegalStateException,
121: IllegalArgumentException {
122: try {
123: CacheTypeMapping target = (CacheTypeMapping) object;
124: // if null, use delete method for optional primitives
125: if (value == null) {
126: target.deleteDebug();
127: return;
128: }
129: target.setDebug(((java.lang.Boolean) value)
130: .booleanValue());
131: } catch (java.lang.Exception ex) {
132: throw new IllegalStateException(ex.toString());
133: }
134: }
135:
136: public java.lang.Object newInstance(java.lang.Object parent) {
137: return null;
138: }
139: };
140: desc.setHandler(handler);
141: desc.setMultivalued(false);
142: addFieldDescriptor(desc);
143:
144: //-- validation code for: _debug
145: fieldValidator = new org.exolab.castor.xml.FieldValidator();
146: { //-- local scope
147: org.exolab.castor.xml.validators.BooleanValidator typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
148: fieldValidator.setValidator(typeValidator);
149: }
150: desc.setValidator(fieldValidator);
151: //-- _capacity
152: desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
153: java.lang.Long.TYPE, "_capacity", "capacity",
154: org.exolab.castor.xml.NodeType.Attribute);
155: handler = new org.exolab.castor.xml.XMLFieldHandler() {
156: public java.lang.Object getValue(java.lang.Object object)
157: throws IllegalStateException {
158: CacheTypeMapping target = (CacheTypeMapping) object;
159: if (!target.hasCapacity())
160: return null;
161: return new java.lang.Long(target.getCapacity());
162: }
163:
164: public void setValue(java.lang.Object object,
165: java.lang.Object value)
166: throws IllegalStateException,
167: IllegalArgumentException {
168: try {
169: CacheTypeMapping target = (CacheTypeMapping) object;
170: // if null, use delete method for optional primitives
171: if (value == null) {
172: target.deleteCapacity();
173: return;
174: }
175: target.setCapacity(((java.lang.Long) value)
176: .longValue());
177: } catch (java.lang.Exception ex) {
178: throw new IllegalStateException(ex.toString());
179: }
180: }
181:
182: public java.lang.Object newInstance(java.lang.Object parent) {
183: return null;
184: }
185: };
186: desc.setHandler(handler);
187: desc.setMultivalued(false);
188: addFieldDescriptor(desc);
189:
190: //-- validation code for: _capacity
191: fieldValidator = new org.exolab.castor.xml.FieldValidator();
192: { //-- local scope
193: org.exolab.castor.xml.validators.IntegerValidator typeValidator = new org.exolab.castor.xml.validators.IntegerValidator();
194: fieldValidator.setValidator(typeValidator);
195: }
196: desc.setValidator(fieldValidator);
197: //-- initialize element descriptors
198:
199: //-- _paramList
200: desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
201: org.exolab.castor.mapping.xml.Param.class,
202: "_paramList", "param",
203: org.exolab.castor.xml.NodeType.Element);
204: handler = new org.exolab.castor.xml.XMLFieldHandler() {
205: public java.lang.Object getValue(java.lang.Object object)
206: throws IllegalStateException {
207: CacheTypeMapping target = (CacheTypeMapping) object;
208: return target.getParam();
209: }
210:
211: public void setValue(java.lang.Object object,
212: java.lang.Object value)
213: throws IllegalStateException,
214: IllegalArgumentException {
215: try {
216: CacheTypeMapping target = (CacheTypeMapping) object;
217: target
218: .addParam((org.exolab.castor.mapping.xml.Param) value);
219: } catch (java.lang.Exception ex) {
220: throw new IllegalStateException(ex.toString());
221: }
222: }
223:
224: public java.lang.Object newInstance(java.lang.Object parent) {
225: return new org.exolab.castor.mapping.xml.Param();
226: }
227: };
228: desc.setHandler(handler);
229: desc.setNameSpaceURI("http://castor.exolab.org/");
230: desc.setMultivalued(true);
231: addFieldDescriptor(desc);
232:
233: //-- validation code for: _paramList
234: fieldValidator = new org.exolab.castor.xml.FieldValidator();
235: fieldValidator.setMinOccurs(0);
236: { //-- local scope
237: }
238: desc.setValidator(fieldValidator);
239: } //-- org.exolab.castor.mapping.xml.CacheTypeMappingDescriptor()
240:
241: //-----------/
242: //- Methods -/
243: //-----------/
244:
245: /**
246: * Method getAccessMode
247: *
248: *
249: *
250: * @return AccessMode
251: */
252: public org.exolab.castor.mapping.AccessMode getAccessMode() {
253: return null;
254: } //-- org.exolab.castor.mapping.AccessMode getAccessMode()
255:
256: /**
257: * Method getExtends
258: *
259: *
260: *
261: * @return ClassDescriptor
262: */
263: public org.exolab.castor.mapping.ClassDescriptor getExtends() {
264: return null;
265: } //-- org.exolab.castor.mapping.ClassDescriptor getExtends()
266:
267: /**
268: * Method getIdentity
269: *
270: *
271: *
272: * @return FieldDescriptor
273: */
274: public org.exolab.castor.mapping.FieldDescriptor getIdentity() {
275: return identity;
276: } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity()
277:
278: /**
279: * Method getJavaClass
280: *
281: *
282: *
283: * @return Class
284: */
285: public java.lang.Class getJavaClass() {
286: return org.exolab.castor.mapping.xml.CacheTypeMapping.class;
287: } //-- java.lang.Class getJavaClass()
288:
289: /**
290: * Method getNameSpacePrefix
291: *
292: *
293: *
294: * @return String
295: */
296: public java.lang.String getNameSpacePrefix() {
297: return nsPrefix;
298: } //-- java.lang.String getNameSpacePrefix()
299:
300: /**
301: * Method getNameSpaceURI
302: *
303: *
304: *
305: * @return String
306: */
307: public java.lang.String getNameSpaceURI() {
308: return nsURI;
309: } //-- java.lang.String getNameSpaceURI()
310:
311: /**
312: * Method getValidator
313: *
314: *
315: *
316: * @return TypeValidator
317: */
318: public org.exolab.castor.xml.TypeValidator getValidator() {
319: return this ;
320: } //-- org.exolab.castor.xml.TypeValidator getValidator()
321:
322: /**
323: * Method getXMLName
324: *
325: *
326: *
327: * @return String
328: */
329: public java.lang.String getXMLName() {
330: return xmlName;
331: } //-- java.lang.String getXMLName()
332:
333: /**
334: * Method isElementDefinition
335: *
336: *
337: *
338: * @return boolean
339: */
340: public boolean isElementDefinition() {
341: return elementDefinition;
342: } //-- boolean isElementDefinition()
343:
344: }
|