Added generated classes for Castor.

This commit is contained in:
Arjen Poutsma 2009-01-08 11:12:28 +00:00
parent ccd59ca088
commit 8ce1f203ff
6 changed files with 985 additions and 0 deletions

View File

@ -0,0 +1,99 @@
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
* Schema.
* $Id$
*/
package org.springframework.oxm.castor;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;
/**
* Class Flight.
*
* @version $Revision$ $Date$
*/
public class Flight extends FlightType implements java.io.Serializable {
//----------------/
//- Constructors -/
//----------------/
public Flight() {
super();
}
//-----------/
//- Methods -/
//-----------/
/**
* Method isValid.
*
* @return true if this object is valid according to the schema
*/
public boolean isValid() {
try {
validate();
}
catch (org.exolab.castor.xml.ValidationException vex) {
return false;
}
return true;
}
/**
* @throws org.exolab.castor.xml.MarshalException
* if object is null or if any SAXException is thrown during marshaling
* @throws org.exolab.castor.xml.ValidationException
* if this object is an invalid instance according to the schema
*/
public void marshal(final java.io.Writer out)
throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
Marshaller.marshal(this, out);
}
/**
* @throws java.io.IOException if an IOException occurs during marshaling
* @throws org.exolab.castor.xml.ValidationException
* if this object is an invalid instance according to the schema
* @throws org.exolab.castor.xml.MarshalException
* if object is null or if any SAXException is thrown during marshaling
*/
public void marshal(final org.xml.sax.ContentHandler handler)
throws java.io.IOException, org.exolab.castor.xml.MarshalException,
org.exolab.castor.xml.ValidationException {
Marshaller.marshal(this, handler);
}
/**
* Method unmarshal.
*
* @return the unmarshaled org.springframework.oxm.castor.FlightType
* @throws org.exolab.castor.xml.MarshalException
* if object is null or if any SAXException is thrown during marshaling
* @throws org.exolab.castor.xml.ValidationException
* if this object is an invalid instance according to the schema
*/
public static org.springframework.oxm.castor.FlightType unmarshal(final java.io.Reader reader)
throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
return (org.springframework.oxm.castor.FlightType) Unmarshaller
.unmarshal(org.springframework.oxm.castor.Flight.class, reader);
}
/**
* @throws org.exolab.castor.xml.ValidationException
* if this object is an invalid instance according to the schema
*/
public void validate() throws org.exolab.castor.xml.ValidationException {
org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
validator.validate(this);
}
}

View File

@ -0,0 +1,143 @@
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
* Schema.
* $Id$
*/
package org.springframework.oxm.castor;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;
/**
* Class FlightType.
*
* @version $Revision$ $Date$
*/
public class FlightType implements java.io.Serializable {
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/** Field _number. */
private long _number;
/** keeps track of state for field: _number */
private boolean _has_number;
//----------------/
//- Constructors -/
//----------------/
public FlightType() {
super();
}
//-----------/
//- Methods -/
//-----------/
/**
*/
public void deleteNumber() {
this._has_number = false;
}
/**
* Returns the value of field 'number'.
*
* @return the value of field 'Number'.
*/
public long getNumber() {
return this._number;
}
/**
* Method hasNumber.
*
* @return true if at least one Number has been added
*/
public boolean hasNumber() {
return this._has_number;
}
/**
* Method isValid.
*
* @return true if this object is valid according to the schema
*/
public boolean isValid() {
try {
validate();
}
catch (org.exolab.castor.xml.ValidationException vex) {
return false;
}
return true;
}
/**
* @throws org.exolab.castor.xml.MarshalException
* if object is null or if any SAXException is thrown during marshaling
* @throws org.exolab.castor.xml.ValidationException
* if this object is an invalid instance according to the schema
*/
public void marshal(final java.io.Writer out)
throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
Marshaller.marshal(this, out);
}
/**
* @throws java.io.IOException if an IOException occurs during marshaling
* @throws org.exolab.castor.xml.ValidationException
* if this object is an invalid instance according to the schema
* @throws org.exolab.castor.xml.MarshalException
* if object is null or if any SAXException is thrown during marshaling
*/
public void marshal(final org.xml.sax.ContentHandler handler)
throws java.io.IOException, org.exolab.castor.xml.MarshalException,
org.exolab.castor.xml.ValidationException {
Marshaller.marshal(this, handler);
}
/**
* Sets the value of field 'number'.
*
* @param number the value of field 'number'.
*/
public void setNumber(final long number) {
this._number = number;
this._has_number = true;
}
/**
* Method unmarshal.
*
* @return the unmarshaled org.springframework.oxm.castor.FlightType
* @throws org.exolab.castor.xml.MarshalException
* if object is null or if any SAXException is thrown during marshaling
* @throws org.exolab.castor.xml.ValidationException
* if this object is an invalid instance according to the schema
*/
public static org.springframework.oxm.castor.FlightType unmarshal(final java.io.Reader reader)
throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
return (org.springframework.oxm.castor.FlightType) Unmarshaller
.unmarshal(org.springframework.oxm.castor.FlightType.class, reader);
}
/**
* @throws org.exolab.castor.xml.ValidationException
* if this object is an invalid instance according to the schema
*/
public void validate() throws org.exolab.castor.xml.ValidationException {
org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
validator.validate(this);
}
}

View File

@ -0,0 +1,236 @@
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
* Schema.
* $Id$
*/
package org.springframework.oxm.castor;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;
/**
* Class Flights.
*
* @version $Revision$ $Date$
*/
public class Flights implements java.io.Serializable {
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/** Field _flightList. */
private java.util.List _flightList;
//----------------/
//- Constructors -/
//----------------/
public Flights() {
super();
this._flightList = new java.util.ArrayList();
}
//-----------/
//- Methods -/
//-----------/
/**
* @throws java.lang.IndexOutOfBoundsException
* if the index given is outside the bounds of the collection
*/
public void addFlight(final org.springframework.oxm.castor.Flight vFlight)
throws java.lang.IndexOutOfBoundsException {
this._flightList.add(vFlight);
}
/**
* @throws java.lang.IndexOutOfBoundsException
* if the index given is outside the bounds of the collection
*/
public void addFlight(final int index, final org.springframework.oxm.castor.Flight vFlight)
throws java.lang.IndexOutOfBoundsException {
this._flightList.add(index, vFlight);
}
/**
* Method enumerateFlight.
*
* @return an Enumeration over all possible elements of this collection
*/
public java.util.Enumeration enumerateFlight() {
return java.util.Collections.enumeration(this._flightList);
}
/**
* Method getFlight.
*
* @return the value of the org.springframework.oxm.castor.Flight at the given index
* @throws java.lang.IndexOutOfBoundsException
* if the index given is outside the bounds of the collection
*/
public org.springframework.oxm.castor.Flight getFlight(final int index) throws java.lang.IndexOutOfBoundsException {
// check bounds for index
if (index < 0 || index >= this._flightList.size()) {
throw new IndexOutOfBoundsException(
"getFlight: Index value '" + index + "' not in range [0.." + (this._flightList.size() - 1) + "]");
}
return (org.springframework.oxm.castor.Flight) _flightList.get(index);
}
/**
* Method getFlight.Returns the contents of the collection in an Array. <p>Note: Just in case the collection
* contents are changing in another thread, we pass a 0-length Array of the correct type into the API call. This
* way we <i>know</i> that the Array returned is of exactly the correct length.
*
* @return this collection as an Array
*/
public org.springframework.oxm.castor.Flight[] getFlight() {
org.springframework.oxm.castor.Flight[] array = new org.springframework.oxm.castor.Flight[0];
return (org.springframework.oxm.castor.Flight[]) this._flightList.toArray(array);
}
/**
* Method getFlightCount.
*
* @return the size of this collection
*/
public int getFlightCount() {
return this._flightList.size();
}
/**
* Method isValid.
*
* @return true if this object is valid according to the schema
*/
public boolean isValid() {
try {
validate();
}
catch (org.exolab.castor.xml.ValidationException vex) {
return false;
}
return true;
}
/**
* Method iterateFlight.
*
* @return an Iterator over all possible elements in this collection
*/
public java.util.Iterator iterateFlight() {
return this._flightList.iterator();
}
/**
* @throws org.exolab.castor.xml.MarshalException
* if object is null or if any SAXException is thrown during marshaling
* @throws org.exolab.castor.xml.ValidationException
* if this object is an invalid instance according to the schema
*/
public void marshal(final java.io.Writer out)
throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
Marshaller.marshal(this, out);
}
/**
* @throws java.io.IOException if an IOException occurs during marshaling
* @throws org.exolab.castor.xml.ValidationException
* if this object is an invalid instance according to the schema
* @throws org.exolab.castor.xml.MarshalException
* if object is null or if any SAXException is thrown during marshaling
*/
public void marshal(final org.xml.sax.ContentHandler handler)
throws java.io.IOException, org.exolab.castor.xml.MarshalException,
org.exolab.castor.xml.ValidationException {
Marshaller.marshal(this, handler);
}
/**
*/
public void removeAllFlight() {
this._flightList.clear();
}
/**
* Method removeFlight.
*
* @return true if the object was removed from the collection.
*/
public boolean removeFlight(final org.springframework.oxm.castor.Flight vFlight) {
boolean removed = _flightList.remove(vFlight);
return removed;
}
/**
* Method removeFlightAt.
*
* @return the element removed from the collection
*/
public org.springframework.oxm.castor.Flight removeFlightAt(final int index) {
java.lang.Object obj = this._flightList.remove(index);
return (org.springframework.oxm.castor.Flight) obj;
}
/**
* @throws java.lang.IndexOutOfBoundsException
* if the index given is outside the bounds of the collection
*/
public void setFlight(final int index, final org.springframework.oxm.castor.Flight vFlight)
throws java.lang.IndexOutOfBoundsException {
// check bounds for index
if (index < 0 || index >= this._flightList.size()) {
throw new IndexOutOfBoundsException(
"setFlight: Index value '" + index + "' not in range [0.." + (this._flightList.size() - 1) + "]");
}
this._flightList.set(index, vFlight);
}
/**
*
*
* @param vFlightArray
*/
public void setFlight(final org.springframework.oxm.castor.Flight[] vFlightArray) {
//-- copy array
_flightList.clear();
for (int i = 0; i < vFlightArray.length; i++) {
this._flightList.add(vFlightArray[i]);
}
}
/**
* Method unmarshal.
*
* @return the unmarshaled org.springframework.oxm.castor.Flight
* @throws org.exolab.castor.xml.MarshalException
* if object is null or if any SAXException is thrown during marshaling
* @throws org.exolab.castor.xml.ValidationException
* if this object is an invalid instance according to the schema
*/
public static org.springframework.oxm.castor.Flights unmarshal(final java.io.Reader reader)
throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
return (org.springframework.oxm.castor.Flights) Unmarshaller
.unmarshal(org.springframework.oxm.castor.Flights.class, reader);
}
/**
* @throws org.exolab.castor.xml.ValidationException
* if this object is an invalid instance according to the schema
*/
public void validate() throws org.exolab.castor.xml.ValidationException {
org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
validator.validate(this);
}
}

View File

@ -0,0 +1,132 @@
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
* Schema.
* $Id$
*/
package org.springframework.oxm.castor.descriptors;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
/**
* Class FlightDescriptor.
*
* @version $Revision$ $Date$
*/
public class FlightDescriptor extends org.springframework.oxm.castor.descriptors.FlightTypeDescriptor {
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/** Field _elementDefinition. */
private boolean _elementDefinition;
/** Field _nsPrefix. */
private java.lang.String _nsPrefix;
/** Field _nsURI. */
private java.lang.String _nsURI;
/** Field _xmlName. */
private java.lang.String _xmlName;
/** Field _identity. */
private org.exolab.castor.xml.XMLFieldDescriptor _identity;
//----------------/
//- Constructors -/
//----------------/
public FlightDescriptor() {
super();
setExtendsWithoutFlatten(new org.springframework.oxm.castor.descriptors.FlightTypeDescriptor());
_nsURI = "http://samples.springframework.org/flight";
_xmlName = "flight";
_elementDefinition = true;
}
//-----------/
//- Methods -/
//-----------/
/**
* Method getAccessMode.
*
* @return the access mode specified for this class.
*/
public org.exolab.castor.mapping.AccessMode getAccessMode() {
return null;
}
/**
* Method getIdentity.
*
* @return the identity field, null if this class has no identity.
*/
public org.exolab.castor.mapping.FieldDescriptor getIdentity() {
if (_identity == null) {
return super.getIdentity();
}
return _identity;
}
/**
* Method getJavaClass.
*
* @return the Java class represented by this descriptor.
*/
public java.lang.Class getJavaClass() {
return org.springframework.oxm.castor.Flight.class;
}
/**
* Method getNameSpacePrefix.
*
* @return the namespace prefix to use when marshaling as XML.
*/
public java.lang.String getNameSpacePrefix() {
return _nsPrefix;
}
/**
* Method getNameSpaceURI.
*
* @return the namespace URI used when marshaling and unmarshaling as XML.
*/
public java.lang.String getNameSpaceURI() {
return _nsURI;
}
/**
* Method getValidator.
*
* @return a specific validator for the class described by this ClassDescriptor.
*/
public org.exolab.castor.xml.TypeValidator getValidator() {
return this;
}
/**
* Method getXMLName.
*
* @return the XML Name for the Class being described.
*/
public java.lang.String getXMLName() {
return _xmlName;
}
/**
* Method isElementDefinition.
*
* @return true if XML schema definition of this Class is that of a global element or element with anonymous type
* definition.
*/
public boolean isElementDefinition() {
return _elementDefinition;
}
}

View File

@ -0,0 +1,189 @@
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
* Schema.
* $Id$
*/
package org.springframework.oxm.castor.descriptors;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
import org.springframework.oxm.castor.FlightType;
/**
* Class FlightTypeDescriptor.
*
* @version $Revision$ $Date$
*/
public class FlightTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/** Field _elementDefinition. */
private boolean _elementDefinition;
/** Field _nsPrefix. */
private java.lang.String _nsPrefix;
/** Field _nsURI. */
private java.lang.String _nsURI;
/** Field _xmlName. */
private java.lang.String _xmlName;
/** Field _identity. */
private org.exolab.castor.xml.XMLFieldDescriptor _identity;
//----------------/
//- Constructors -/
//----------------/
public FlightTypeDescriptor() {
super();
_nsURI = "http://samples.springframework.org/flight";
_xmlName = "flightType";
_elementDefinition = false;
//-- set grouping compositor
setCompositorAsSequence();
org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
org.exolab.castor.mapping.FieldHandler handler = null;
org.exolab.castor.xml.FieldValidator fieldValidator = null;
//-- initialize attribute descriptors
//-- initialize element descriptors
//-- _number
desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Long.TYPE, "_number", "number",
org.exolab.castor.xml.NodeType.Element);
handler = new org.exolab.castor.xml.XMLFieldHandler() {
public java.lang.Object getValue(java.lang.Object object) throws IllegalStateException {
FlightType target = (FlightType) object;
if (!target.hasNumber()) {
return null;
}
return new java.lang.Long(target.getNumber());
}
public void setValue(java.lang.Object object, java.lang.Object value)
throws IllegalStateException, IllegalArgumentException {
try {
FlightType target = (FlightType) object;
// ignore null values for non optional primitives
if (value == null) {
return;
}
target.setNumber(((java.lang.Long) value).longValue());
}
catch (java.lang.Exception ex) {
throw new IllegalStateException(ex.toString());
}
}
public java.lang.Object newInstance(java.lang.Object parent) {
return null;
}
};
desc.setHandler(handler);
desc.setNameSpaceURI("http://samples.springframework.org/flight");
desc.setRequired(true);
desc.setMultivalued(false);
addFieldDescriptor(desc);
//-- validation code for: _number
fieldValidator = new org.exolab.castor.xml.FieldValidator();
fieldValidator.setMinOccurs(1);
{ //-- local scope
org.exolab.castor.xml.validators.LongValidator typeValidator;
typeValidator = new org.exolab.castor.xml.validators.LongValidator();
fieldValidator.setValidator(typeValidator);
typeValidator.setMinInclusive(-9223372036854775808L);
typeValidator.setMaxInclusive(9223372036854775807L);
}
desc.setValidator(fieldValidator);
}
//-----------/
//- Methods -/
//-----------/
/**
* Method getAccessMode.
*
* @return the access mode specified for this class.
*/
public org.exolab.castor.mapping.AccessMode getAccessMode() {
return null;
}
/**
* Method getIdentity.
*
* @return the identity field, null if this class has no identity.
*/
public org.exolab.castor.mapping.FieldDescriptor getIdentity() {
return _identity;
}
/**
* Method getJavaClass.
*
* @return the Java class represented by this descriptor.
*/
public java.lang.Class getJavaClass() {
return org.springframework.oxm.castor.FlightType.class;
}
/**
* Method getNameSpacePrefix.
*
* @return the namespace prefix to use when marshaling as XML.
*/
public java.lang.String getNameSpacePrefix() {
return _nsPrefix;
}
/**
* Method getNameSpaceURI.
*
* @return the namespace URI used when marshaling and unmarshaling as XML.
*/
public java.lang.String getNameSpaceURI() {
return _nsURI;
}
/**
* Method getValidator.
*
* @return a specific validator for the class described by this ClassDescriptor.
*/
public org.exolab.castor.xml.TypeValidator getValidator() {
return this;
}
/**
* Method getXMLName.
*
* @return the XML Name for the Class being described.
*/
public java.lang.String getXMLName() {
return _xmlName;
}
/**
* Method isElementDefinition.
*
* @return true if XML schema definition of this Class is that of a global element or element with anonymous type
* definition.
*/
public boolean isElementDefinition() {
return _elementDefinition;
}
}

View File

@ -0,0 +1,186 @@
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
* Schema.
* $Id$
*/
package org.springframework.oxm.castor.descriptors;
//---------------------------------/
//- Imported classes and packages -/
//---------------------------------/
import org.springframework.oxm.castor.Flights;
/**
* Class FlightsDescriptor.
*
* @version $Revision$ $Date$
*/
public class FlightsDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
//--------------------------/
//- Class/Member Variables -/
//--------------------------/
/** Field _elementDefinition. */
private boolean _elementDefinition;
/** Field _nsPrefix. */
private java.lang.String _nsPrefix;
/** Field _nsURI. */
private java.lang.String _nsURI;
/** Field _xmlName. */
private java.lang.String _xmlName;
/** Field _identity. */
private org.exolab.castor.xml.XMLFieldDescriptor _identity;
//----------------/
//- Constructors -/
//----------------/
public FlightsDescriptor() {
super();
_nsURI = "http://samples.springframework.org/flight";
_xmlName = "flights";
_elementDefinition = true;
//-- set grouping compositor
setCompositorAsSequence();
org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
org.exolab.castor.mapping.FieldHandler handler = null;
org.exolab.castor.xml.FieldValidator fieldValidator = null;
//-- initialize attribute descriptors
//-- initialize element descriptors
//-- _flightList
desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.springframework.oxm.castor.Flight.class,
"_flightList", "flight", org.exolab.castor.xml.NodeType.Element);
handler = new org.exolab.castor.xml.XMLFieldHandler() {
public java.lang.Object getValue(java.lang.Object object) throws IllegalStateException {
Flights target = (Flights) object;
return target.getFlight();
}
public void setValue(java.lang.Object object, java.lang.Object value)
throws IllegalStateException, IllegalArgumentException {
try {
Flights target = (Flights) object;
target.addFlight((org.springframework.oxm.castor.Flight) value);
}
catch (java.lang.Exception ex) {
throw new IllegalStateException(ex.toString());
}
}
public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
try {
Flights target = (Flights) object;
target.removeAllFlight();
}
catch (java.lang.Exception ex) {
throw new IllegalStateException(ex.toString());
}
}
public java.lang.Object newInstance(java.lang.Object parent) {
return new org.springframework.oxm.castor.Flight();
}
};
desc.setHandler(handler);
desc.setNameSpaceURI("http://samples.springframework.org/flight");
desc.setRequired(true);
desc.setMultivalued(true);
addFieldDescriptor(desc);
//-- validation code for: _flightList
fieldValidator = new org.exolab.castor.xml.FieldValidator();
fieldValidator.setMinOccurs(1);
{ //-- local scope
}
desc.setValidator(fieldValidator);
}
//-----------/
//- Methods -/
//-----------/
/**
* Method getAccessMode.
*
* @return the access mode specified for this class.
*/
public org.exolab.castor.mapping.AccessMode getAccessMode() {
return null;
}
/**
* Method getIdentity.
*
* @return the identity field, null if this class has no identity.
*/
public org.exolab.castor.mapping.FieldDescriptor getIdentity() {
return _identity;
}
/**
* Method getJavaClass.
*
* @return the Java class represented by this descriptor.
*/
public java.lang.Class getJavaClass() {
return org.springframework.oxm.castor.Flights.class;
}
/**
* Method getNameSpacePrefix.
*
* @return the namespace prefix to use when marshaling as XML.
*/
public java.lang.String getNameSpacePrefix() {
return _nsPrefix;
}
/**
* Method getNameSpaceURI.
*
* @return the namespace URI used when marshaling and unmarshaling as XML.
*/
public java.lang.String getNameSpaceURI() {
return _nsURI;
}
/**
* Method getValidator.
*
* @return a specific validator for the class described by this ClassDescriptor.
*/
public org.exolab.castor.xml.TypeValidator getValidator() {
return this;
}
/**
* Method getXMLName.
*
* @return the XML Name for the Class being described.
*/
public java.lang.String getXMLName() {
return _xmlName;
}
/**
* Method isElementDefinition.
*
* @return true if XML schema definition of this Class is that of a global element or element with anonymous type
* definition.
*/
public boolean isElementDefinition() {
return _elementDefinition;
}
}