001: /*
002: * This class was automatically generated with
003: * <a href="http://www.castor.org">Castor 0.9.4.3</a>, using an XML
004: * Schema.
005: * $Id$
006: */
007:
008: package com.calipso.reportgenerator.reportdefinitions;
009:
010: //---------------------------------/
011: //- Imported classes and packages -/
012: //---------------------------------/
013:
014: import org.exolab.castor.mapping.AccessMode;
015: import org.exolab.castor.xml.TypeValidator;
016: import org.exolab.castor.xml.XMLFieldDescriptor;
017: import org.exolab.castor.xml.validators.*;
018:
019: /**
020: * Class MetricDefinitionDescriptor.
021: *
022: * @version $Revision$ $Date$
023: */
024: public class MetricDefinitionDescriptor extends
025: org.exolab.castor.xml.util.XMLClassDescriptorImpl {
026:
027: //--------------------------/
028: //- Class/Member Variables -/
029: //--------------------------/
030:
031: /**
032: * Field nsPrefix
033: */
034: private java.lang.String nsPrefix;
035:
036: /**
037: * Field nsURI
038: */
039: private java.lang.String nsURI;
040:
041: /**
042: * Field xmlName
043: */
044: private java.lang.String xmlName;
045:
046: /**
047: * Field identity
048: */
049: private org.exolab.castor.xml.XMLFieldDescriptor identity;
050:
051: //----------------/
052: //- Constructors -/
053: //----------------/
054:
055: public MetricDefinitionDescriptor() {
056: super ();
057: xmlName = "MetricDefinition";
058: org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
059: org.exolab.castor.xml.XMLFieldHandler handler = null;
060: org.exolab.castor.xml.FieldValidator fieldValidator = null;
061: //-- initialize attribute descriptors
062:
063: //-- _name
064: desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
065: java.lang.String.class, "_name", "Name",
066: org.exolab.castor.xml.NodeType.Attribute);
067: desc.setImmutable(true);
068: handler = (new org.exolab.castor.xml.XMLFieldHandler() {
069: public java.lang.Object getValue(java.lang.Object object)
070: throws IllegalStateException {
071: MetricDefinition target = (MetricDefinition) object;
072: return target.getName();
073: }
074:
075: public void setValue(java.lang.Object object,
076: java.lang.Object value)
077: throws IllegalStateException,
078: IllegalArgumentException {
079: try {
080: MetricDefinition target = (MetricDefinition) object;
081: target.setName((java.lang.String) value);
082: } catch (java.lang.Exception ex) {
083: throw new IllegalStateException(ex.toString());
084: }
085: }
086:
087: public java.lang.Object newInstance(java.lang.Object parent) {
088: return null;
089: }
090: });
091: desc.setHandler(handler);
092: desc.setRequired(true);
093: addFieldDescriptor(desc);
094:
095: //-- validation code for: _name
096: fieldValidator = new org.exolab.castor.xml.FieldValidator();
097: fieldValidator.setMinOccurs(1);
098: { //-- local scope
099: StringValidator typeValidator = new StringValidator();
100: typeValidator.setWhiteSpace("preserve");
101: fieldValidator.setValidator(typeValidator);
102: }
103: desc.setValidator(fieldValidator);
104: //-- _description
105: desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
106: java.lang.String.class, "_description", "Description",
107: org.exolab.castor.xml.NodeType.Attribute);
108: desc.setImmutable(true);
109: handler = (new org.exolab.castor.xml.XMLFieldHandler() {
110: public java.lang.Object getValue(java.lang.Object object)
111: throws IllegalStateException {
112: MetricDefinition target = (MetricDefinition) object;
113: return target.getDescription();
114: }
115:
116: public void setValue(java.lang.Object object,
117: java.lang.Object value)
118: throws IllegalStateException,
119: IllegalArgumentException {
120: try {
121: MetricDefinition target = (MetricDefinition) object;
122: target.setDescription((java.lang.String) value);
123: } catch (java.lang.Exception ex) {
124: throw new IllegalStateException(ex.toString());
125: }
126: }
127:
128: public java.lang.Object newInstance(java.lang.Object parent) {
129: return null;
130: }
131: });
132: desc.setHandler(handler);
133: addFieldDescriptor(desc);
134:
135: //-- validation code for: _description
136: fieldValidator = new org.exolab.castor.xml.FieldValidator();
137: { //-- local scope
138: StringValidator typeValidator = new StringValidator();
139: typeValidator.setWhiteSpace("preserve");
140: fieldValidator.setValidator(typeValidator);
141: }
142: desc.setValidator(fieldValidator);
143: //-- _visible
144: desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
145: java.lang.Boolean.TYPE, "_visible", "Visible",
146: org.exolab.castor.xml.NodeType.Attribute);
147: handler = (new org.exolab.castor.xml.XMLFieldHandler() {
148: public java.lang.Object getValue(java.lang.Object object)
149: throws IllegalStateException {
150: MetricDefinition target = (MetricDefinition) object;
151: if (!target.hasVisible())
152: return null;
153: return new Boolean(target.getVisible());
154: }
155:
156: public void setValue(java.lang.Object object,
157: java.lang.Object value)
158: throws IllegalStateException,
159: IllegalArgumentException {
160: try {
161: MetricDefinition target = (MetricDefinition) object;
162: // ignore null values for non optional primitives
163: if (value == null)
164: return;
165:
166: target.setVisible(((Boolean) value).booleanValue());
167: } catch (java.lang.Exception ex) {
168: throw new IllegalStateException(ex.toString());
169: }
170: }
171:
172: public java.lang.Object newInstance(java.lang.Object parent) {
173: return null;
174: }
175: });
176: desc.setHandler(handler);
177: desc.setRequired(true);
178: addFieldDescriptor(desc);
179:
180: //-- validation code for: _visible
181: fieldValidator = new org.exolab.castor.xml.FieldValidator();
182: fieldValidator.setMinOccurs(1);
183: { //-- local scope
184: BooleanValidator typeValidator = new BooleanValidator();
185: fieldValidator.setValidator(typeValidator);
186: }
187: desc.setValidator(fieldValidator);
188: //-- _accumulable
189: desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
190: java.lang.Boolean.TYPE, "_accumulable", "Accumulable",
191: org.exolab.castor.xml.NodeType.Attribute);
192: handler = (new org.exolab.castor.xml.XMLFieldHandler() {
193: public java.lang.Object getValue(java.lang.Object object)
194: throws IllegalStateException {
195: MetricDefinition target = (MetricDefinition) object;
196: if (!target.hasAccumulable())
197: return null;
198: return new Boolean(target.getAccumulable());
199: }
200:
201: public void setValue(java.lang.Object object,
202: java.lang.Object value)
203: throws IllegalStateException,
204: IllegalArgumentException {
205: try {
206: MetricDefinition target = (MetricDefinition) object;
207: // if null, use delete method for optional primitives
208: if (value == null) {
209: target.deleteAccumulable();
210: return;
211: }
212: target.setAccumulable(((Boolean) value)
213: .booleanValue());
214: } catch (java.lang.Exception ex) {
215: throw new IllegalStateException(ex.toString());
216: }
217: }
218:
219: public java.lang.Object newInstance(java.lang.Object parent) {
220: return null;
221: }
222: });
223: desc.setHandler(handler);
224: addFieldDescriptor(desc);
225:
226: //-- validation code for: _accumulable
227: fieldValidator = new org.exolab.castor.xml.FieldValidator();
228: { //-- local scope
229: BooleanValidator typeValidator = new BooleanValidator();
230: fieldValidator.setValidator(typeValidator);
231: }
232: desc.setValidator(fieldValidator);
233: //-- initialize element descriptors
234:
235: } //-- com.calipso.reportgenerator.reportdefinitions.MetricDefinitionDescriptor()
236:
237: //-----------/
238: //- Methods -/
239: //-----------/
240:
241: /**
242: * Method getAccessMode
243: */
244: public org.exolab.castor.mapping.AccessMode getAccessMode() {
245: return null;
246: } //-- org.exolab.castor.mapping.AccessMode getAccessMode()
247:
248: /**
249: * Method getExtends
250: */
251: public org.exolab.castor.mapping.ClassDescriptor getExtends() {
252: return null;
253: } //-- org.exolab.castor.mapping.ClassDescriptor getExtends()
254:
255: /**
256: * Method getIdentity
257: */
258: public org.exolab.castor.mapping.FieldDescriptor getIdentity() {
259: return identity;
260: } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity()
261:
262: /**
263: * Method getJavaClass
264: */
265: public java.lang.Class getJavaClass() {
266: return com.calipso.reportgenerator.reportdefinitions.MetricDefinition.class;
267: } //-- java.lang.Class getJavaClass()
268:
269: /**
270: * Method getNameSpacePrefix
271: */
272: public java.lang.String getNameSpacePrefix() {
273: return nsPrefix;
274: } //-- java.lang.String getNameSpacePrefix()
275:
276: /**
277: * Method getNameSpaceURI
278: */
279: public java.lang.String getNameSpaceURI() {
280: return nsURI;
281: } //-- java.lang.String getNameSpaceURI()
282:
283: /**
284: * Method getValidator
285: */
286: public org.exolab.castor.xml.TypeValidator getValidator() {
287: return this ;
288: } //-- org.exolab.castor.xml.TypeValidator getValidator()
289:
290: /**
291: * Method getXMLName
292: */
293: public java.lang.String getXMLName() {
294: return xmlName;
295: } //-- java.lang.String getXMLName()
296:
297: }
|