Index: bugs/xml/c1470/test-binding.xml =================================================================== --- bugs/xml/c1470/test-binding.xml (Revision 0) +++ bugs/xml/c1470/test-binding.xml (Revision 0) @@ -0,0 +1,16 @@ + + + + + + + + + + + + Index: bugs/xml/c1470/TestSourceGenerator.java =================================================================== --- bugs/xml/c1470/TestSourceGenerator.java (Revision 0) +++ bugs/xml/c1470/TestSourceGenerator.java (Revision 0) @@ -0,0 +1,19 @@ +package xml.c1470; + +import org.exolab.castor.builder.SourceGenerator; +import org.xml.sax.InputSource; + +import junit.framework.TestCase; + +public class TestSourceGenerator extends TestCase +{ + + public void testGeneration() throws Exception { + SourceGenerator generator = new SourceGenerator(); + String xmlSchema = getClass().getResource("test.xsd").toExternalForm(); + InputSource inputSource = new InputSource(xmlSchema); + generator.setBinding(new InputSource(getClass().getResource("test-binding.xml").toExternalForm())); + generator.setDestDir("d:/dev/workspace-trunk/steven/src/main/java"); + generator.generateSource(inputSource, "org.exolab.castor.test"); + } +} Index: bugs/xml/c1470/test.xsd =================================================================== --- bugs/xml/c1470/test.xsd (Revision 0) +++ bugs/xml/c1470/test.xsd (Revision 0) @@ -0,0 +1,29 @@ + + + + + + + + + + Index: bugs/xml/c1470/castorbuilder.properties =================================================================== --- bugs/xml/c1470/castorbuilder.properties (Revision 0) +++ bugs/xml/c1470/castorbuilder.properties (Revision 0) @@ -0,0 +1,12 @@ +# +# Property file for SourceCodeGenerator +# +# $Id: castorbuilder.properties 5951 2006-05-30 22:18:48Z bsnyder $ + +# Set to true if you want the generated source code to contain +# Extra methods for the collection fields, such as get/set using +# the collection type in addition to the type-safe array. +# Set this to true if you want your code to be more compatible +# with Castor JDO. This is false by default. +# +org.exolab.castor.builder.extraCollectionMethods=true Index: main/java/org/exolab/javasource/JStructure.java =================================================================== --- main/java/org/exolab/javasource/JStructure.java (Revision 6030) +++ main/java/org/exolab/javasource/JStructure.java (Arbeitskopie) @@ -196,7 +196,14 @@ //-- getPackageName String pkgName = getPackageFromClassName(className); - + String localClassName = className; + + // DAB -- for Java 5.0, remove any Parameterized types here + int paramTypeDeclPos = className.indexOf("<"); + if ( paramTypeDeclPos != -1 ) { + localClassName = className.substring(0, paramTypeDeclPos ); + } + if (pkgName != null) { if (pkgName.equals(this.packageName)) return; @@ -546,6 +553,11 @@ if (name == null) return false; + int beforeTypeName = name.indexOf("<"); + if (beforeTypeName > 0) { + name = name.substring(0, beforeTypeName); + } + //-- ignore package information, for now int period = name.lastIndexOf("."); if (period>0) Index: main/java/org/exolab/javasource/JMethodSignature.java =================================================================== --- main/java/org/exolab/javasource/JMethodSignature.java (Revision 6030) +++ main/java/org/exolab/javasource/JMethodSignature.java (Arbeitskopie) @@ -384,6 +384,7 @@ sb.append(returnType); } else sb.append("void"); + sb.append(' '); sb.append(name); sb.append('('); Index: main/java/org/exolab/javasource/JClass.java =================================================================== --- main/java/org/exolab/javasource/JClass.java (Revision 6030) +++ main/java/org/exolab/javasource/JClass.java (Arbeitskopie) @@ -540,6 +540,12 @@ Enumeration enumeration = iClass.getImports(); while (enumeration.hasMoreElements()) { String classname = (String)enumeration.nextElement(); + + // DAB - hack to allow Java 5 parameterized types to pass correctly + int paramTypeIndex = classname.indexOf(""); + if ( paramTypeIndex != -1 ) { + classname = classname.substring(0,paramTypeIndex-1); + } if (!hasImport(classname)) { addImport(classname); removeImports.addElement(classname); @@ -652,6 +658,13 @@ typeName = type.getLocalName(); } jsw.write(typeName); + + // TODO: why deal with Vector independently ? +// // DAB - Java 5 hack +// if ( typeName.indexOf("Vector") != -1 && +// typeName.indexOf("") == -1 ) { +// jsw.write(""); +// } jsw.write(' '); jsw.write(jField.getName()); Index: main/java/org/exolab/javasource/Java5HacksHelper.java =================================================================== --- main/java/org/exolab/javasource/Java5HacksHelper.java (Revision 0) +++ main/java/org/exolab/javasource/Java5HacksHelper.java (Revision 0) @@ -0,0 +1,123 @@ +package org.exolab.javasource; + +import java.util.HashMap; + +// DAB - Java 5.0 hack to set Override annotation +public class Java5HacksHelper { + + // This is a static class wrapper + private Java5HacksHelper() {} + + static private class MethodSpec { + public String methodName = null; + public int paramCount = 0; + public String param1ClassName = null; + public String param2ClassName = null; + } + +// static HashMap definedSpecs = new HashMap(); + static HashMap definedSpecs = new HashMap(); + + static void createMethodSpec(String methodName, int paramCount, String param1ClassName, String param2ClassName) { + MethodSpec temp = new MethodSpec(); + temp.methodName = methodName; + temp.paramCount = paramCount; + temp.param1ClassName = param1ClassName; + temp.param2ClassName = param2ClassName; + + definedSpecs.put(methodName, temp); + } + + + static + { + createMethodSpec("getAccessMode", 0, "", ""); + createMethodSpec("getExtends", 0, "", ""); + createMethodSpec("getIdentity", 0, "", ""); + createMethodSpec("getJavaClass", 0, "", ""); + createMethodSpec("getNameSpacePrefix", 0, "", ""); + createMethodSpec("getNameSpaceURI", 0, "", ""); + createMethodSpec("getValidator", 0, "", ""); + createMethodSpec("getXMLName", 0, "", ""); + createMethodSpec("getXTransients", 0, "", ""); + createMethodSpec("newInstance", 1, "java.lang.Object", ""); + createMethodSpec("setValue", 1, "java.lang.Object", ""); + createMethodSpec("equals", 1, "java.lang.Object", ""); + createMethodSpec("getValue", 1, "java.lang.Object", ""); + createMethodSpec("marshal", 1, "java.io.Writer", ""); + createMethodSpec("newInstance", 1, "java.lang.Object", ""); + createMethodSpec("setValue", 2, "java.lang.Object", "java.lang.Object"); + createMethodSpec("setXTransients", 1, "org.openmrm.core.data.castor.XTransients",""); +// createMethodSpec("getAttributeId", 0, "", ""); + }; + + + public static void addOverrideAnnotations(JMethodSignature jms) { + String name = jms.getName(); + boolean addOverrideAnnotation = false; + + // 0. It the method already has an override annotation, then jump out + JAnnotation override = jms.getAnnotation(new JAnnotationType("Override")); + if ( override != null) { + return; + } + + // 1. Does the method name exist in our list +// MethodSpec methodSpec = definedSpecs.get(name); + MethodSpec methodSpec = (MethodSpec) definedSpecs.get(name); + + // 2. If we have a methodSpec, then test the parameters + if ( methodSpec != null) { + + // if the correct number of parameters + int paramCount = jms.getParameters().length; + if ( paramCount == methodSpec.paramCount ) { + + + // then check the 0 param methods + if (paramCount == 0 && + methodSpec.paramCount == 0 + ) { + addOverrideAnnotation = true; + + } + + + // then check the 1 param methods + if (paramCount == 1 && + methodSpec.paramCount == 1 ) { + String incommingClassName1 = jms.getParameter(0).getType().getName(); + if ( incommingClassName1.equalsIgnoreCase(methodSpec.param1ClassName) ) { + addOverrideAnnotation = true; + } + + } + + // then check the 2 param methods + if (paramCount == 2 && + methodSpec.paramCount == 2 ){ + + String incommingClassName1 = jms.getParameter(0).getType().getName(); + String incommingClassName2 = jms.getParameter(1).getType().getName(); + if ( incommingClassName1.equalsIgnoreCase(methodSpec.param1ClassName) && + incommingClassName2.equalsIgnoreCase(methodSpec.param2ClassName) ) { + addOverrideAnnotation = true; + } + + } + + + } + + + } + + + // 3. do the work if we need to + if ( addOverrideAnnotation ) { + jms.addAnnotation(new JAnnotation(new JAnnotationType("Override"))); + } + + } + +} Index: main/java/org/exolab/javasource/JNaming.java =================================================================== --- main/java/org/exolab/javasource/JNaming.java (Revision 6030) +++ main/java/org/exolab/javasource/JNaming.java (Arbeitskopie) @@ -69,6 +69,7 @@ "do", "double", "else", + "enum", // DAB - 01:02:03 -- 04/05/2006 - Java 5.0 - new keyword "extends", "false", "final", @@ -107,6 +108,35 @@ "while" }; //-- keywords + // DAB - 01:02:03 -- 04/05/2006 - Java 5.0 - collection are now parameterized + private static final String[] parameterizedCollectionsObject = { + "ArrayList", + "List", + "Set", + "Collection", + "Vector", + "Hashtable", + "Map", + "HashMap", + "HashSet", + "TreeSet", + "Enumeration", + "Iterator", + "ListIterator", + "SortedSet", + "SortedMap", + "Queue", + "EnumSet", + "EnumMap", + "IdentityHashMap", + "LinkedHashMap", + "LinkedHashSet", + "LinkedList", + "Stack", + "TreeMap", + "WeakHashMap" + }; //-- parameterizedCollectionsObject + private JNaming() { super(); @@ -125,6 +155,20 @@ } //-- isKeyword /** + * Returns true if the given String is a parameritized + * Java collection object keyword which + * will cause a problem when used as a variable name + **/ + public static boolean isParameterizedCollectionsObject(String name) { + if (name == null) return false; + for (int i = 0; i < parameterizedCollectionsObject.length; i++) { + if (name.indexOf(parameterizedCollectionsObject[i]) != -1) return true; + } + return false; + } //-- isParameterizedCollectionsObject + + + /** * Returns true if the given String matches the * production of a valid Java identifier * @@ -139,6 +183,11 @@ char[] chars = string.toCharArray(); + // DAB - first test for my hacked objects + if ( isParameterizedCollectionsObject(string)) { + return true; + } + //-- make sure starting character is valid if (!Character.isJavaIdentifierStart(chars[0])) return false; Index: main/java/org/exolab/javasource/JType.java =================================================================== --- main/java/org/exolab/javasource/JType.java (Revision 6030) +++ main/java/org/exolab/javasource/JType.java (Arbeitskopie) @@ -65,10 +65,18 @@ private String name = null; + /** + * Indicates whether this JType represents an array + */ private boolean _isArray = false; /** - * used for array types + * Indicates whether this JType represents a collection + */ + private boolean _isCollection = false; + + /** + * used for array and collection types **/ private JType _componentType = null; @@ -93,12 +101,26 @@ jType._componentType = this; return jType; } //-- createArray - + /** - * If this JType is an array this method will returns the component type - * of the array, otherwise null will be returned. - * @return the component JType if this JType is an array, otherwise null. + * Creates a JType Object representing a collection of the current + * JType. + * @return the new JType which is represents a collection. **/ + public final static JType createCollection(String name, JType componentType) { + JType jType = new JType(name); + jType._isCollection = true; + jType._componentType = componentType; + return jType; + } //-- createCollection + + /** + * If this JType is an array/collection, this method will return + * the component type of the array/collection, otherwise null will be + * returned. + * @return the component JType if this JType is an array/collection, + * otherwise null. + **/ public JType getComponentType() { return _componentType; } //-- getComponentType @@ -127,7 +149,16 @@ public final boolean isArray() { return _isArray; } + + /** + * Checks to see if this JType represents a collection. + * @return true if this JType represents a collection, otherwise false + **/ + public final boolean isCollection() { + return _isCollection; + } + /** * Checks to see if this JType represents a primitive * @return true if this JType represents a primitive, otherwise false @@ -150,7 +181,14 @@ **/ public String toString() { - if (_isArray) return _componentType.toString()+"[]"; + if (_isArray) { + return _componentType.toString()+"[]"; + } + + if (isCollection()) { + return name + "<" + _componentType.toString() + ">"; + } + return this.name; } //-- toString Index: main/java/org/exolab/castor/xml/schema/Schema.java =================================================================== --- main/java/org/exolab/castor/xml/schema/Schema.java (Revision 6030) +++ main/java/org/exolab/castor/xml/schema/Schema.java (Arbeitskopie) @@ -525,7 +525,9 @@ if (_importedSchemas.get(targetNamespace)!=null) { String err = "a Schema has already been imported with the given namespace: "; - throw new SchemaException(err + targetNamespace); + // LINE BELOW COMMENTED OUT BY inter0p for our usage + // requirement of our CodeGenerator process + //throw new SchemaException(err + targetNamespace); } _importedSchemas.put(targetNamespace, schema); } //-- addImportedSchema Index: main/java/org/exolab/castor/builder/FieldInfo.java =================================================================== --- main/java/org/exolab/castor/builder/FieldInfo.java (Revision 6030) +++ main/java/org/exolab/castor/builder/FieldInfo.java (Arbeitskopie) @@ -323,6 +323,7 @@ //-- create get method method = new JMethod(jType, METHOD_PREFIX_GET+mname); + Java5HacksHelper.addOverrideAnnotations(method.getSignature()); jClass.addMethod(method); createGetterComment(method.getJDocComment()); jsc = method.getSourceCode(); @@ -453,6 +454,7 @@ } method.addParameter(new JParameter(jType, paramName)); + Java5HacksHelper.addOverrideAnnotations(method.getSignature()); // DAB Java 5.0 hack createSetterComment(method.getJDocComment()); jsc = method.getSourceCode(); Index: main/java/org/exolab/castor/builder/CollectionInfoJ2.java =================================================================== --- main/java/org/exolab/castor/builder/CollectionInfoJ2.java (Revision 6030) +++ main/java/org/exolab/castor/builder/CollectionInfoJ2.java (Arbeitskopie) @@ -84,7 +84,7 @@ **/ public void generateInitializerCode(JSourceCode jsc) { jsc.add(getName()); - jsc.append(" = new java.util.ArrayList();"); + jsc.append(" = new ArrayList();"); } //-- generateConstructorCode //------------------/ Index: main/java/org/exolab/castor/builder/CollectionInfo.java =================================================================== --- main/java/org/exolab/castor/builder/CollectionInfo.java (Revision 6030) +++ main/java/org/exolab/castor/builder/CollectionInfo.java (Arbeitskopie) @@ -117,7 +117,10 @@ **/ public void generateInitializerCode(JSourceCode jsc) { jsc.add(getName()); - jsc.append(" = new java.util.Vector();"); + + jsc.append(" = new "); + jsc.append(xsList.getJType().toString()); + jsc.append("();"); } //-- generateConstructorCode public String getReadMethodName() { @@ -252,7 +255,7 @@ //- Create Enumerate Method -/ //---------------------------/ - method = new JMethod(SGTypes.Enumeration, "enumerate"+cName); + method = new JMethod(SGTypes.createEnumeration(contentType.getJType()),"enumerate"+cName); jClass.addMethod(method); createEnumerateMethod(method); Index: main/java/org/exolab/castor/builder/types/XSListJ2.java =================================================================== --- main/java/org/exolab/castor/builder/types/XSListJ2.java (Revision 6030) +++ main/java/org/exolab/castor/builder/types/XSListJ2.java (Arbeitskopie) @@ -55,7 +55,7 @@ * The JType represented by this XSType **/ private static final JType jType - = new JClass("java.util.ArrayList"); + = new JClass("java.util.ArrayList"); public XSListJ2(XSType contentType) { super(contentType); Index: main/java/org/exolab/castor/builder/types/XSList.java =================================================================== --- main/java/org/exolab/castor/builder/types/XSList.java (Revision 6030) +++ main/java/org/exolab/castor/builder/types/XSList.java (Arbeitskopie) @@ -63,12 +63,12 @@ /** * The JType represented by this XSType **/ - private static final JType jType - = new JClass("java.util.Vector"); + private JType jType = null; public XSList(XSType contentType) { super(XSType.COLLECTION); this.contentType = contentType; + this.jType = JType.createCollection("java.util.Vector", contentType.getJType()); } //-- XSList @@ -77,7 +77,7 @@ * @return the JType that this XSType represents **/ public JType getJType() { - return XSList.jType; + return this.jType; } public int getMinimumSize() { Index: main/java/org/exolab/castor/builder/DescriptorSourceFactory.java =================================================================== --- main/java/org/exolab/castor/builder/DescriptorSourceFactory.java (Revision 6030) +++ main/java/org/exolab/castor/builder/DescriptorSourceFactory.java (Arbeitskopie) @@ -454,6 +454,7 @@ jsc.indent(); //-- read method + jsc.add("@Override"); jsc.add("public java.lang.Object getValue( java.lang.Object object ) "); jsc.indent(); jsc.add("throws IllegalStateException"); @@ -486,6 +487,7 @@ //--end of read method //-- write method + jsc.add("@Override"); jsc.add( "public void setValue( java.lang.Object object, java.lang.Object value) "); jsc.indent(); @@ -561,6 +563,8 @@ //--end of write method //-- newInstance method + jsc.add("@Override"); + jsc.add("@SuppressWarnings(\"unused\")"); jsc.add( "public java.lang.Object newInstance( java.lang.Object parent ) {"); jsc.indent(); Index: main/java/org/exolab/castor/builder/SourceFactory.java =================================================================== --- main/java/org/exolab/castor/builder/SourceFactory.java (Revision 6030) +++ main/java/org/exolab/castor/builder/SourceFactory.java (Arbeitskopie) @@ -50,6 +50,8 @@ package org.exolab.castor.builder; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.exolab.castor.builder.binding.ExtendedBinding; import org.exolab.castor.builder.binding.XMLBindingComponent; import org.exolab.castor.builder.types.XSClass; @@ -76,6 +78,8 @@ import org.exolab.castor.xml.schema.Structure; import org.exolab.castor.xml.schema.Wildcard; import org.exolab.castor.xml.schema.XMLType; +import org.exolab.javasource.JAnnotation; +import org.exolab.javasource.JAnnotationType; import org.exolab.javasource.JClass; import org.exolab.javasource.JConstructor; import org.exolab.javasource.JDocComment; @@ -603,6 +607,10 @@ //--create equals, bounds ... //NOTE: be careful with the derivation stuff when generating bounds properties + // DAB 2006-05-10 -- add imports required by the marshal methods + jClass.addImport("java.io.Writer"); + jClass.addImport("java.io.Reader"); + if (_createMarshalMethods) { //-- #validate() createValidateMethods(jClass); @@ -790,6 +798,11 @@ jClass.addInterface("java.io.Serializable"); + + // DAB 2006-05-10 - added serial warning suppression of generated classes + JAnnotation serial = new JAnnotation(new JAnnotationType("SuppressWarnings")); + serial.setValue(new String[] {"\"serial\""}); + jClass.addAnnotation(serial); //-- add default constructor JConstructor con = jClass.createConstructor(); @@ -930,6 +943,10 @@ jMethod.addException(SGTypes.MarshalException); jMethod.addException(SGTypes.ValidationException); jMethod.addParameter(new JParameter(SGTypes.Writer, "out")); + + // DAB 2006-05-10 - added annotation + // jMethod.addAnnotation(new JAnnotation(new JAnnotationType("Override"))); + parent.addMethod(jMethod); if (isAbstract) { @@ -1091,6 +1108,10 @@ jMethod.setComment("Override the java.lang.Object.equals method"); jMethod.setComment("Note: hashCode() has not been overriden"); jMethod.addParameter(new JParameter(SGTypes.Object, "obj")); + + // DAB 2006-05-10 - added annotation + jMethod.addAnnotation(new JAnnotation(new JAnnotationType("Override"))); + jclass.addMethod(jMethod); JSourceCode jsc = jMethod.getSourceCode(); jsc.add("if ( this == obj )"); @@ -1216,8 +1237,8 @@ String componentName = null; if (name.indexOf("Has") == -1) { //Collection needs a specific handling - if ( (type.getName().equals("java.util.Vector")) || - (type.getName().equals("java.util.ArrayList")) ) { + if ( (type.getName().equals("java.util.Vector")) || + (type.getName().equals("java.util.ArrayList")) ) { //if we are dealing with a Vector or an ArrayList //we retrieve the type included in this Collection int listLocat = name.lastIndexOf("List"); @@ -1810,7 +1831,7 @@ jClass.addMethod(mInit); mInit.getModifiers().makePrivate(); mInit.getModifiers().setStatic(true); - mInit.getSourceCode().add("java.util.Hashtable members = new java.util.Hashtable();"); + mInit.getSourceCode().add("Hashtable members = new Hashtable();"); //-- #readResolve method JMethod mReadResolve = new JMethod(SGTypes.Object,"readResolve"); Index: main/java/org/exolab/castor/builder/util/DescriptorJClass.java =================================================================== --- main/java/org/exolab/castor/builder/util/DescriptorJClass.java (Revision 6030) +++ main/java/org/exolab/castor/builder/util/DescriptorJClass.java (Arbeitskopie) @@ -177,6 +177,10 @@ //-- create getNameSpacePrefix method method = new JMethod(SGTypes.String, "getNameSpacePrefix"); + + // DAB 2006-05-10 - added annotation + method.addAnnotation(new JAnnotation(new JAnnotationType("Override"))); + jsc = method.getSourceCode(); jsc.add("return nsPrefix;"); addMethod(method); @@ -184,6 +188,10 @@ //-- create getNameSpaceURI method method = new JMethod(SGTypes.String, "getNameSpaceURI"); + + // DAB 2006-05-10 - added annotation + method.addAnnotation(new JAnnotation(new JAnnotationType("Override"))); + jsc = method.getSourceCode(); jsc.add("return nsURI;"); addMethod(method); @@ -191,12 +199,20 @@ //-- create getValidator method method = new JMethod(_TypeValidatorClass, "getValidator"); + + // DAB 2006-05-10 - added annotation + method.addAnnotation(new JAnnotation(new JAnnotationType("Override"))); + jsc = method.getSourceCode(); jsc.add("return this;"); addMethod(method); //-- create getXMLName method method = new JMethod(SGTypes.String, "getXMLName"); + + // DAB 2006-05-10 - added annotation + method.addAnnotation(new JAnnotation(new JAnnotationType("Override"))); + jsc = method.getSourceCode(); jsc.add("return xmlName;"); addMethod(method); @@ -210,6 +226,10 @@ //-- create getAccessMode method JClass amClass = new JClass("org.exolab.castor.mapping.AccessMode"); method = new JMethod(amClass, "getAccessMode"); + + // DAB 2006-05-10 - added annotation + method.addAnnotation(new JAnnotation(new JAnnotationType("Override"))); + jsc = method.getSourceCode(); jsc.add("return null;"); addMethod(method); @@ -217,6 +237,10 @@ //-- create getExtends method method = new JMethod(_ClassDescriptorClass, "getExtends"); + + // DAB 2006-05-10 - added annotation + method.addAnnotation(new JAnnotation(new JAnnotationType("Override"))); + jsc = method.getSourceCode(); if (extended) { jsc.add("return super.getExtends();"); @@ -231,6 +255,10 @@ //-- create getIdentity method method = new JMethod(_FieldDescriptorClass, "getIdentity"); + + // DAB 2006-05-10 - added annotation + method.addAnnotation(new JAnnotation(new JAnnotationType("Override"))); + jsc = method.getSourceCode(); if (extended) { jsc.add("if (identity == null)"); @@ -246,6 +274,10 @@ //-- create getJavaClass method method = new JMethod(SGTypes.Class, "getJavaClass"); + + // DAB 2006-05-10 - added annotation + method.addAnnotation(new JAnnotation(new JAnnotationType("Override"))); + jsc = method.getSourceCode(); jsc.add("return "); jsc.append(classType(_type)); Index: main/java/org/exolab/castor/builder/SGTypes.java =================================================================== --- main/java/org/exolab/castor/builder/SGTypes.java (Revision 6030) +++ main/java/org/exolab/castor/builder/SGTypes.java (Arbeitskopie) @@ -105,13 +105,17 @@ public static final JClass Writer = new JClass("java.io.Writer"); //-- java.util - public static final JClass ArrayList = new JClass("java.util.ArrayList"); - public static final JClass Enumeration = new JClass("java.util.Enumeration"); - public static final JClass Iterator = new JClass("java.util.Iterator"); - public static final JClass Hashtable = new JClass("java.util.Hashtable"); - public static final JClass Stack = new JClass("java.util.Stack"); - public static final JClass Vector = new JClass("java.util.Vector"); + public static final JClass ArrayList = new JClass("java.util.ArrayList"); + public static final JClass Enumeration = new JClass("java.util.Enumeration"); + public static final JClass Iterator = new JClass("java.util.Iterator"); + public static final JClass Hashtable = new JClass("java.util.Hashtable"); + public static final JClass Stack = new JClass("java.util.Stack"); + public static final JClass Vector = new JClass("java.util.Vector"); //-- java.beans public static final JClass PropertyChangeSupport = new JClass("java.beans.PropertyChangeSupport"); + + public static final JType createEnumeration (JType jType) { + return JType.createCollection("java.util.Enumeration", jType); + } } //-- SGTypes Index: main/java/org/exolab/castor/mapping/loader/J2CollectionHandlers.java =================================================================== --- main/java/org/exolab/castor/mapping/loader/J2CollectionHandlers.java (Revision 6030) +++ main/java/org/exolab/castor/mapping/loader/J2CollectionHandlers.java (Arbeitskopie) @@ -113,7 +113,7 @@ return null; } public String toString() { - return "List"; + return "List"; } } ), new CollectionHandlers.Info( "arraylist", ArrayList.class, false, new CollectionHandler() { @@ -143,7 +143,7 @@ return null; } public String toString() { - return "ArrayList"; + return "ArrayList"; } } ), // For Collection/ArrayList (1.2) @@ -174,7 +174,7 @@ return null; } public String toString() { - return "Collection"; + return "Collection"; } } ), // For Set/HashSet (1.2) @@ -206,7 +206,7 @@ return null; } public String toString() { - return "Set"; + return "Set"; } } ), // For Map/HashMap (1.2) @@ -253,7 +253,7 @@ return null; } public String toString() { - return "Map"; + return "SortedSet"; } } ), // For SortedSet (1.2 aka 1.4) @@ -278,7 +278,7 @@ return null; } public String toString() { - return "Iterator"; + return "Iterator"; } } )