Hello alltogether, I have several xsds with several enumeration types wich all contain only numeric values like "1000", "1100", "2000" ...
The source generator in the java classes produces elements called VALUE_0, VALUE_1, ... and VALUE_0_TYPE, VALUE_1_TYPE, ... This makes it difficult to see the original numeric semantics when using the "VALUE_X" constants. Or for example, if I delete or insert an enumeration element "1200" between "1100" and "2000" in the xsd and regenerate the java class the constant for the value"2000" is not VALUE_2 anymore but it will be VALUE_3. Is it possible to let the value of numeric elements survive in the constant names by calling them VALUE_<numVal> and VALUE_<numval>_TYPE so in my example the constants would be VALUE_1000, VALUE_1100, VALUE_2000, ... and after I insert element "1200" these names are only extended by VALUE_1200. I would then not have to rename heaps of VALUE_abcd's in my code where I use objects of the generated classes. Thanks, Ulf -- NEU F�R ALLE - GMX MediaCenter - f�r Fotos, Musik, Dateien... Fotoalbum, File Sharing, MMS, Multimedia-Gru�, GMX FotoService Jetzt kostenlos anmelden unter http://www.gmx.net +++ GMX - die erste Adresse f�r Mail, Message, More! +++/* * This class was automatically generated with * Castor 0.9.4.3, using an XML * Schema. * $Id$ */ package adv.types; //---------------------------------/ //- Imported classes and packages -/ //---------------------------------/ import java.io.Serializable; import java.util.Enumeration; import java.util.Hashtable; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; /** * Class xFoobarType. * * @version $Revision$ $Date$ */ public class xFoobarType implements java.io.Serializable { //--------------------------/ //- Class/Member Variables -/ //--------------------------/ /** * The 1000 type */ public static final int VALUE_0_TYPE = 0; /** * The instance of the 1000 type */ public static final xFoobarType VALUE_0 = new xFoobarType(VALUE_0_TYPE, "1000"); /** * The 1010 type */ public static final int VALUE_1_TYPE = 1; /** * The instance of the 1010 type */ public static final xFoobarType VALUE_1 = new xFoobarType(VALUE_1_TYPE, "1010"); /** * The 1020 type */ public static final int VALUE_2_TYPE = 2; /** * The instance of the 1020 type */ public static final xFoobarType VALUE_2 = new xFoobarType(VALUE_2_TYPE, "1020"); /** * The 1021 type */ public static final int VALUE_3_TYPE = 3; /** * The instance of the 1021 type */ public static final xFoobarType VALUE_3 = new xFoobarType(VALUE_3_TYPE, "1021"); /** * The 1022 type */ public static final int VALUE_4_TYPE = 4; /** * The instance of the 1022 type */ public static final xFoobarType VALUE_4 = new xFoobarType(VALUE_4_TYPE, "1022"); /** * The 1023 type */ public static final int VALUE_5_TYPE = 5; /** * The instance of the 1023 type */ public static final xFoobarType VALUE_5 = new xFoobarType(VALUE_5_TYPE, "1023"); /** * The 1024 type */ public static final int VALUE_6_TYPE = 6; /** * The instance of the 1024 type */ public static final xFoobarType VALUE_6 = new xFoobarType(VALUE_6_TYPE, "1024"); /** * The 1025 type */ public static final int VALUE_7_TYPE = 7; /** * The instance of the 1025 type */ public static final xFoobarType VALUE_7 = new xFoobarType(VALUE_7_TYPE, "1025"); /* ... 100s more */ /** * Field _memberTable */ private static java.util.Hashtable _memberTable = init(); /** * Field type */ private int type = -1; /** * Field stringValue */ private java.lang.String stringValue = null; //----------------/ //- Constructors -/ //----------------/ private xFoobarType(int type, java.lang.String value) { super(); this.type = type; this.stringValue = value; } //-- adv.types.xFoobarType(int, java.lang.String) //-----------/ //- Methods -/ //-----------/ /** * Method enumerateReturns an enumeration of all possible * instances of xFoobarType */ public static java.util.Enumeration enumerate() { return _memberTable.elements(); } //-- java.util.Enumeration enumerate() /** * Method getTypeReturns the type of this xFoobarType */ public int getType() { return this.type; } //-- int getType() /** * Method init */ private static java.util.Hashtable init() { Hashtable members = new Hashtable(); members.put("1000", VALUE_0); members.put("1010", VALUE_1); members.put("1020", VALUE_2); members.put("1021", VALUE_3); members.put("1022", VALUE_4); members.put("1023", VALUE_5); members.put("1024", VALUE_6); members.put("1025", VALUE_7); /* ... 100s more */ return members; } //-- java.util.Hashtable init() /** * Method toStringReturns the String representation of this * xFoobarType */ public java.lang.String toString() { return this.stringValue; } //-- java.lang.String toString() /** * Method valueOfReturns a new xFoobarType based on * the given String value. * * @param string */ public static adv.types.xFoobarType valueOf(java.lang.String string) { java.lang.Object obj = null; if (string != null) obj = _memberTable.get(string); if (obj == null) { String err = "'" + string + "' is not a valid xFoobarType"; throw new IllegalArgumentException(err); } return (xFoobarType) obj; } //-- adv.types.xFoobarType valueOf(java.lang.String) }
