xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject cvs commit: xml-xmlbeans/v2/test/src/drt/drtcases BindingTests.java
Date Tue, 16 Dec 2003 09:55:06 GMT
pcal        2003/12/16 01:55:06

  Modified:    v2/src/binding/org/apache/xmlbeans/impl/binding/bts
                        BindingProperty.java JavaTypeName.java
               v2/src/binding/org/apache/xmlbeans/impl/binding/compile
                        BindingCompiler.java Both2Bind.java
                        Java2Schema.java Schema2Java.java
               v2/src/binding/org/apache/xmlbeans/impl/binding/tylar
                        JarredTylar.java
               v2/src/configschema/schema binding-config.xsd
               v2/src/jam/org/apache/xmlbeans/impl/jam/internal
                        PrimitiveJClass.java
               v2/src/jam/org/apache/xmlbeans/impl/jam/internal/javadoc
                        JDClassLoader.java JDClassLoaderFactory.java
               v2/src/jam/org/apache/xmlbeans/impl/jam/internal/reflect
                        RClassLoader.java
               v2/src/marshal/org/apache/xmlbeans/impl/marshal
                        ByNameRuntimeBindingType.java
               v2/test/cases/marshal example_config.xml
               v2/test/src/drt/drtcases BindingTests.java
  Added:       v2/src/binding/org/apache/xmlbeans/impl/binding/bts
                        MethodName.java
  Log:
  add MethodName to bts, change schema, update compilers/runtime/tests
  also fix problem with output in JDClassLoaderFactory
  
  Revision  Changes    Path
  1.6       +23 -16    xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/bts/BindingProperty.java
  
  Index: BindingProperty.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/bts/BindingProperty.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BindingProperty.java	4 Dec 2003 21:14:55 -0000	1.5
  +++ BindingProperty.java	16 Dec 2003 09:55:05 -0000	1.6
  @@ -57,6 +57,8 @@
   package org.apache.xmlbeans.impl.binding.bts;
   
   import org.apache.xmlbeans.SchemaType;
  +import org.apache.xmlbeans.impl.jam.JMethod;
  +import org.apache.xml.xmlbeans.bindingConfig.JavaMethodName;
   
   /**
    * Represents a property.  Every property corresponds to a
  @@ -67,8 +69,8 @@
   public abstract class BindingProperty
   {
       private BindingTypeName btName;
  -    private String getter;
  -    private String setter;
  +    private MethodName getter;
  +    private MethodName setter;
       private String field;
       private JavaTypeName collection;
       
  @@ -91,8 +93,8 @@
           this.btName = BindingTypeName.forPair(
                           JavaTypeName.forString(node.getJavatype()),
                           XmlTypeName.forString(node.getXmlcomponent()));
  -        this.getter = node.getGetter();
  -        this.setter = node.getSetter();
  +        this.getter = MethodName.create(node.getGetter());
  +        this.setter = MethodName.create(node.getSetter());
           this.field = node.getField();
           String collection = node.getCollection();
           if (collection != null)
  @@ -112,10 +114,12 @@
           node.setXmlcomponent(btName.getXmlName().toString());
           if (getFieldName() != null)
               node.setField(getFieldName());
  -        if (getGetterName() != null)
  -            node.setGetter(getGetterName());
  -        if (getSetterName() != null)
  -            node.setSetter(getSetterName());
  +        if (getGetterName() != null) {
  +          getGetterName().write(node.addNewGetter());
  +        }
  +        if (getSetterName() != null) {
  +          getSetterName().write(node.addNewSetter());
  +        }
           if (getCollectionClass() != null)
               node.setCollection(getCollectionClass().toString());
           return node;
  @@ -136,14 +140,14 @@
           btName = bType.getName();
       }
       
  -    public String getGetterName()
  +    public MethodName getGetterName()
       {
           return isField() ? null : getter;
       }
       
  -    public void setGetterName(String getter)
  +    public void setGetterName(MethodName mn)
       {
  -        this.getter = getter;
  +        getter = mn;
       }
       
       public boolean hasSetter()
  @@ -151,14 +155,14 @@
           return !isField() && setter != null;
       }
       
  -    public String getSetterName()
  +    public MethodName getSetterName()
       {
           return isField() ? null : setter;
       }
       
  -    public void setSetterName(String setter)
  +    public void setSetterName(MethodName mn)
       {
  -        this.setter = setter; 
  +        setter = mn;
       }
       
       public String getFieldName()
  @@ -180,7 +184,8 @@
       {
           collection = jName;
       }
  -    
  +
  +
       /* REGISTRY OF SUBCLASSES */
       
       private static final Class[] ctorArgs = new Class[] {org.apache.xml.xmlbeans.bindingConfig.BindingProperty.class};
  @@ -197,7 +202,9 @@
               throw (IllegalStateException)new IllegalStateException("Cannot load class for " + node.schemaType() + ": should be registered.").initCause(e);
           }
       }
  -    
  +
  +
  +
       /**
        * Should only be called by BindingFile, when loading up bindingtypes
        */
  
  
  
  1.2       +31 -0     xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/bts/JavaTypeName.java
  
  Index: JavaTypeName.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/bts/JavaTypeName.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JavaTypeName.java	4 Dec 2003 21:14:55 -0000	1.1
  +++ JavaTypeName.java	16 Dec 2003 09:55:05 -0000	1.2
  @@ -57,7 +57,9 @@
   package org.apache.xmlbeans.impl.binding.bts;
   
   import org.apache.xmlbeans.impl.jam.JClass;
  +import org.apache.xmlbeans.impl.jam.internal.PrimitiveJClass;
   import org.apache.xmlbeans.XmlObject;
  +import java.io.StringWriter;
   
   /**
    * Represents a Java class name, and provides some utility methods
  @@ -257,5 +259,34 @@
       public int hashCode()
       {
           return className.hashCode() + arrayString.length() + (isXmlObject ? 1 : 0);
  +    }
  +
  +    /**
  +     * Loads the class represented by this JavaTypeName in the given
  +     * ClassLoader.  This is really horrible - the impedance mismatch
  +     * in the naming here is very really painful.  Need to do something better.
  +     */
  +    public Class loadClassIn(ClassLoader loader) throws ClassNotFoundException {
  +      int d = getArrayDepth();
  +      if (d == 0) {
  +        String s = toString();
  +        Class out = PrimitiveJClass.getPrimitiveClass(s);
  +        if (out != null) return out;
  +        return loader.loadClass(s);
  +      } else {
  +        StringWriter buff = new StringWriter();
  +        for(int i=0; i<d; i++) buff.write("[");
  +        String s = toString();
  +        s = s.substring(0,s.indexOf("["));
  +        String fd = PrimitiveJClass.getFieldDescriptor(s);
  +        if (fd != null) {
  +          buff.write(fd);
  +        } else {
  +          buff.write("L");
  +          buff.write(s);
  +          buff.write(";");
  +        }
  +        return loader.loadClass(buff.toString());
  +      }
       }
   }
  
  
  
  1.1                  xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/bts/MethodName.java
  
  Index: MethodName.java
  ===================================================================
  package org.apache.xmlbeans.impl.binding.bts;
  
  import org.apache.xmlbeans.impl.jam.JMethod;
  import org.apache.xmlbeans.impl.jam.JParameter;
  import org.apache.xml.xmlbeans.bindingConfig.JavaMethodName;
  import java.lang.reflect.Method;
  import java.util.Arrays;
  
  /**
   * Abstraction which uniquely identifies a particular method on some class.
   * This requires both a method name and some information about the method
   * signature - this class just provides a structured representation of
   * that information, as well a service (getMethodOn) for reflecting
   * on a given class to find the java.lang.Method named by the MethodName.
   *
   * The basic motivation for adding this class is to remove guesswork from the
   * runtime about how to map a 'getterName' string plus some notion of
   * property type to an actual java.lang.Method.  With MethodName, the
   * binding file is able to make make it completely unambiguous.
   *
   * @author Patrick Calahan <pcal@bea.com>
   */
  public class MethodName {
  
    // ========================================================================
    // Variables
  
    private String mMethodName;
    private JavaTypeName[] mParamTypes;
  
    // ========================================================================
    // Factory methods
  
    /**
     * Creates a MethodName which names the given JMethod.
     */
    public static MethodName create(JMethod m) {
      JParameter[] params = m.getParameters();
      if (params == null || params.length == 0) {
        return new MethodName(m.getSimpleName());
      } else {
        JavaTypeName[] types = new JavaTypeName[params.length];
        for(int i=0; i<types.length; i++) {
          types[i] = JavaTypeName.forJClass(params[i].getType());
        }
        return new MethodName(m.getSimpleName(),types);
      }
    }
  
    /**
     * Creates a MethodName for a method with the given name and no parameters
     * (e.g., a getter).
     */
    public static MethodName create(String methodName) {
      return new MethodName(methodName);
    }
  
    /**
     * Creates a MethodName for a method with the given name and a single
     * parameter of the given type (e.g., a setter).
     */
    public static MethodName create(String methodName, JavaTypeName paramType) {
      return create(methodName,new JavaTypeName[] {paramType});
    }
  
    /**
     * Creates a MethodName for a method with the given name and a set
     * of parameters of the given types.
     */
    public static MethodName create(String methodName, JavaTypeName[] paramTypes) {
      if (paramTypes == null || paramTypes.length == 0) {
        return new MethodName(methodName);
      } else {
        return new MethodName(methodName,paramTypes);
      }
    }
  
    /**
     * Creates a MethodName from the given XmlObject.
     */
    /*package*/ static MethodName create(JavaMethodName jmn) {
  
      return create(jmn.getMethodName(),
                    namesForStrings(jmn.getParamTypeArray()));
    }
  
    private static JavaTypeName[] namesForStrings(String[] names) {
      JavaTypeName[] out = new JavaTypeName[names.length];
      for(int i=0; i<out.length; i++) out[i] = JavaTypeName.forString(names[i]);
      return out;
    }
  
  
    // ========================================================================
    // Constructors
  
    private MethodName(String methodName, JavaTypeName[] types) {
      mMethodName = methodName;
      mParamTypes = types;
    }
  
    private MethodName(String methodName) {
      mMethodName = methodName;
      mParamTypes = new JavaTypeName[0];
    }
  
    // ========================================================================
    // Public methods
  
    public String getSimpleName() { return mMethodName; }
  
    /**
     * Returns the java.lang.Method which is named by this MethodName
     * on the given class.
     *
     * @param containingClass Class to be searched for the method.
     * @return
     * @throws ClassNotFoundException if one of the paramType classes specified
     * for this MethodName cannot be loaded from the given class' classloader.
     * @throws NoSuchMethodException If the named method does not exist on
     * this class.
     * @throws IllegalArgumentException if containingClass is null.
     */
    public Method getMethodOn(Class containingClass)
            throws ClassNotFoundException, NoSuchMethodException
    {
      if (containingClass == null) {
        throw new IllegalArgumentException("null class");
      }
      Class[] types = null;
      if (mParamTypes != null && mParamTypes.length > 0) {
        types = new Class[mParamTypes.length];
        for(int i=0; i<types.length; i++) {
          types[i] = mParamTypes[i].loadClassIn(containingClass.getClassLoader());
        }
      }
      return containingClass.getMethod(mMethodName,types);
    }
  
    // ========================================================================
    // Object implementation
  
    public boolean equals(Object o) {
      if (this == o) return true;
      if (!(o instanceof MethodName)) return false;
      final MethodName methodName = (MethodName) o;
      if (mMethodName != null ? !mMethodName.equals(methodName.mMethodName) :
              methodName.mMethodName != null) return false;
      if (!Arrays.equals(mParamTypes, methodName.mParamTypes)) return false;
  
      return true;
    }
  
    public int hashCode() {
      return (mMethodName != null ? mMethodName.hashCode() : 0);
    }
  
  
    // ========================================================================
    // Package methods
  
    /**
     * Populates the given xmlobject with our contents.
     */
    /*package*/ void write(JavaMethodName name) {
      name.setMethodName(mMethodName);
      if (mParamTypes != null && mParamTypes.length > 0) {
        String[] types = new String[mParamTypes.length];
        for(int i=0; i<types.length; i++) types[i] = mParamTypes[i].toString();
        name.setParamTypeArray(types);
      }
    }
  
   /* should make this a test
    public static void main(String[] args) throws Exception {
      test("java.lang.String",String.class);
      test("java.lang.String[]",String[].class);
      test("int",int.class);
      test("int[]",int[].class);
      test("double[][][]",double[][][].class);
    }
  
    public static void test(String jtn, Class c) throws Exception {
      JavaTypeName name = JavaTypeName.forString(jtn);
      if (!name.loadClassIn(ClassLoader.getSystemClassLoader()).equals(c)) {
        System.out.println(jtn+" failed "+c.getName());
      } else {
        System.out.println(jtn+" passed "+c.getName());
      }
    }
    */
  }
  
  
  1.3       +0 -1      xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/compile/BindingCompiler.java
  
  Index: BindingCompiler.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/compile/BindingCompiler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BindingCompiler.java	13 Dec 2003 07:56:28 -0000	1.2
  +++ BindingCompiler.java	16 Dec 2003 09:55:05 -0000	1.3
  @@ -146,7 +146,6 @@
       bind((TylarWriter)tylar);
       try {
         // close it up.  this may cause the generated code to be compiled.
  -      System.out.println("COMPILE!!!!!!!!!!!!!!!!!!");
         if (mDoCompile) logVerbose("Compiling java sources...");
         tylar.close();
       } catch(IOException ioe) {
  
  
  
  1.3       +3 -13     xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/compile/Both2Bind.java
  
  Index: Both2Bind.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/compile/Both2Bind.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Both2Bind.java	11 Dec 2003 19:32:54 -0000	1.2
  +++ Both2Bind.java	16 Dec 2003 09:55:05 -0000	1.3
  @@ -58,17 +58,7 @@
   
   import org.apache.xmlbeans.impl.jam.JClass;
   import org.apache.xmlbeans.impl.jam.JProperty;
  -import org.apache.xmlbeans.impl.binding.bts.BindingTypeName;
  -import org.apache.xmlbeans.impl.binding.bts.BindingType;
  -import org.apache.xmlbeans.impl.binding.bts.JavaTypeName;
  -import org.apache.xmlbeans.impl.binding.bts.QNameProperty;
  -import org.apache.xmlbeans.impl.binding.bts.ByNameBean;
  -import org.apache.xmlbeans.impl.binding.bts.BindingFile;
  -import org.apache.xmlbeans.impl.binding.bts.XmlTypeName;
  -import org.apache.xmlbeans.impl.binding.bts.BuiltinBindingLoader;
  -import org.apache.xmlbeans.impl.binding.bts.BindingLoader;
  -import org.apache.xmlbeans.impl.binding.bts.SimpleBindingType;
  -import org.apache.xmlbeans.impl.binding.bts.SimpleDocumentBinding;
  +import org.apache.xmlbeans.impl.binding.bts.*;
   import org.apache.xmlbeans.SchemaProperty;
   import org.apache.xmlbeans.SchemaType;
   import org.apache.xmlbeans.XmlOptions;
  @@ -667,8 +657,8 @@
               QNameProperty prop = new QNameProperty();
               prop.setQName(sProp.getName());
               prop.setAttribute(sProp.isAttribute());
  -            prop.setSetterName(jProp.getSetter().getSimpleName());
  -            prop.setGetterName(jProp.getGetter().getSimpleName());
  +            prop.setSetterName(MethodName.create(jProp.getSetter()));
  +            prop.setGetterName(MethodName.create(jProp.getGetter()));
               prop.setCollectionClass(collection);
               prop.setBindingType(bType);
               prop.setNillable(sProp.hasNillable() != SchemaProperty.NEVER);
  
  
  
  1.22      +16 -11    xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/compile/Java2Schema.java
  
  Index: Java2Schema.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/compile/Java2Schema.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- Java2Schema.java	14 Dec 2003 21:48:29 -0000	1.21
  +++ Java2Schema.java	16 Dec 2003 09:55:05 -0000	1.22
  @@ -267,24 +267,25 @@
                            (props[i],TAG_EL_NAME,props[i].getSimpleName()));
           }
         }
  -      { // set the getters and setters
  -        facade.setGetter(props[i].getGetter().getSimpleName());
  -        facade.setSetter(props[i].getSetter().getSimpleName());
  -      }
         { // determine the property type to use and set it
  +        JClass propType = null;
           String annotatedType = getAnnotation(props[i],TAG_EL_ASTYPE,null);
           if (annotatedType == null) {
  -          facade.setType(props[i].getType());
  +          facade.setType(propType = props[i].getType());
           } else {
  -          JClass clazz = props[i].getType().forName(annotatedType);
  -          if (clazz.isUnresolved()) {
  +          propType = props[i].getType().forName(annotatedType);
  +          if (propType.isUnresolved()) {
               logError(props[i],"Could not find class named '"+
  -                              clazz.getQualifiedName()+"'");
  +                              propType.getQualifiedName()+"'");
             } else {
  -            facade.setType(clazz);
  +            facade.setType(propType);
             }
           }
         }
  +      { // set the getters and setters
  +        facade.setGetter(props[i].getGetter());
  +        facade.setSetter(props[i].getSetter());
  +      }
         { // determine if the property is nillable
           JAnnotation a = props[i].getAnnotation(TAG_EL_NILLABLE);
           if (a != null) {
  @@ -486,12 +487,16 @@
       /**
        * Sets the name of the java getter for this property.
        */
  -    public void setGetter(String g) { mBtsProp.setGetterName(g); }
  +    public void setGetter(JMethod g) {
  +      mBtsProp.setGetterName(MethodName.create(g));
  +    }
   
       /**
        * Sets the name of the java setter for this property.
        */
  -    public void setSetter(String s) { mBtsProp.setSetterName(s); }
  +    public void setSetter(JMethod s) {
  +      mBtsProp.setSetterName(MethodName.create(s));
  +    }
   
       /**
        * Sets the type of the property.  Currently handles arrays
  
  
  
  1.5       +8 -17     xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/compile/Schema2Java.java
  
  Index: Schema2Java.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/compile/Schema2Java.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Schema2Java.java	13 Dec 2003 07:56:28 -0000	1.4
  +++ Schema2Java.java	16 Dec 2003 09:55:05 -0000	1.5
  @@ -56,16 +56,7 @@
   
   package org.apache.xmlbeans.impl.binding.compile;
   
  -import org.apache.xmlbeans.impl.binding.bts.BindingFile;
  -import org.apache.xmlbeans.impl.binding.bts.BindingType;
  -import org.apache.xmlbeans.impl.binding.bts.BindingLoader;
  -import org.apache.xmlbeans.impl.binding.bts.XmlTypeName;
  -import org.apache.xmlbeans.impl.binding.bts.JavaTypeName;
  -import org.apache.xmlbeans.impl.binding.bts.ByNameBean;
  -import org.apache.xmlbeans.impl.binding.bts.QNameProperty;
  -import org.apache.xmlbeans.impl.binding.bts.SimpleBindingType;
  -import org.apache.xmlbeans.impl.binding.bts.BindingTypeName;
  -import org.apache.xmlbeans.impl.binding.bts.SimpleDocumentBinding;
  +import org.apache.xmlbeans.impl.binding.bts.*;
   import org.apache.xmlbeans.impl.binding.tylar.TylarWriter;
   import org.apache.xmlbeans.impl.binding.joust.JavaOutputStream;
   import org.apache.xmlbeans.impl.binding.joust.Variable;
  @@ -432,8 +423,6 @@
           BindingType bType = bindingTypeForSchemaType(sType);
   
           String propName = pickUniquePropertyName(props[i].getName(), seenMethodNames);
  -        String getter = "get" + propName;
  -        String setter = "set" + propName;
           boolean isMultiple = isMultiple(props[i]);
           JavaTypeName collection = null;
           if (isMultiple)
  @@ -442,8 +431,9 @@
           prop = new QNameProperty();
           prop.setQName(props[i].getName());
           prop.setAttribute(props[i].isAttribute());
  -        prop.setSetterName(setter);
  -        prop.setGetterName(getter);
  +        prop.setSetterName(MethodName.create("set"+propName,
  +                                             bType.getName().getJavaName()));
  +        prop.setGetterName(MethodName.create("get"+propName));
           prop.setCollectionClass(collection);
           prop.setBindingType(bType);
           prop.setNillable(props[i].hasNillable() != SchemaProperty.NEVER);
  @@ -959,7 +949,8 @@
       // pick field names
       for (Iterator i = props.iterator(); i.hasNext();) {
         QNameProperty prop = (QNameProperty) i.next();
  -      fieldNames.put(prop, pickUniqueFieldName(prop.getGetterName(), seenFieldNames));
  +      fieldNames.put(prop, pickUniqueFieldName(prop.getGetterName().getSimpleName(),
  +                                               seenFieldNames));
       }
   
       // print fields, getters, and setters
  @@ -979,14 +970,14 @@
         //write getter
         mJoust.startMethod(Modifier.PUBLIC,
                            jType.toString(),
  -                         prop.getGetterName(),
  +                         prop.getGetterName().getSimpleName(),
                            null, null, null);
         mJoust.writeReturnStatement(propertyField);
         mJoust.endMethodOrConstructor();
         //write setter
         Variable[] params = mJoust.startMethod(Modifier.PUBLIC,
                                                "void",
  -                                             prop.getSetterName(),
  +                                             prop.getSetterName().getSimpleName(),
                                                new String[]{jType.toString()},
                                                new String[]{fieldName},
                                                null);
  
  
  
  1.2       +8 -2      xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/tylar/JarredTylar.java
  
  Index: JarredTylar.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/binding/org/apache/xmlbeans/impl/binding/tylar/JarredTylar.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JarredTylar.java	11 Dec 2003 01:49:03 -0000	1.1
  +++ JarredTylar.java	16 Dec 2003 09:55:05 -0000	1.2
  @@ -131,7 +131,8 @@
           //FIXME this doesn't work
           //   schemas.add(SchemaDocument.Factory.parse(in));
           // so we do this instead
  -        schemas.add(new StringReader(getEntryContents(in)));
  +        schemas.add(SchemaDocument.Factory.parse
  +                    (new StringReader(getEntryContents(in))));
         } else {
           if (VERBOSE) {
             System.out.println("ignoring unknown jar entry: "+name);
  @@ -228,6 +229,11 @@
       while ((count = in.read(buffer, 0, buffer.length)) != -1) {
         writer.write(new String(buffer, 0, count));
       }
  +    if (VERBOSE) {
  +      System.out.println("=== SCHEMA CONTENTS ===");
  +      System.out.println(writer.toString());
  +      System.out.println("=== END SCHEMA CONTENTS ===");
  +    }
       return writer.toString();
     }
   
  @@ -251,4 +257,4 @@
     }
   
   
  -}
  \ No newline at end of file
  +}
  
  
  
  1.11      +11 -4     xml-xmlbeans/v2/src/configschema/schema/binding-config.xsd
  
  Index: binding-config.xsd
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/configschema/schema/binding-config.xsd,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- binding-config.xsd	4 Dec 2003 21:14:56 -0000	1.10
  +++ binding-config.xsd	16 Dec 2003 09:55:05 -0000	1.11
  @@ -73,7 +73,7 @@
         </xs:extension>
       </xs:complexContent>
     </xs:complexType>
  -    
  +
     <xs:complexType name="wrapped-array">
       <xs:complexContent>
         <xs:extension base="tns:binding-type">
  @@ -81,7 +81,7 @@
             <xs:element name="item-type" type="tns:mapping"/>
             <xs:element name="array-rank" type="xs:int" minOccurs="0"/>
             <xs:element name="element-qname" type="xs:QName" minOccurs="0"/>
  -        </xs:sequence>    
  +        </xs:sequence>
         </xs:extension>
       </xs:complexContent>
     </xs:complexType>
  @@ -103,8 +103,8 @@
         <xs:element name="javatype" type="tns:java-class-name"/>
         <xs:choice>
           <xs:sequence>
  -          <xs:element name="getter" type="tns:java-property-name"/>
  -          <xs:element name="setter" type="tns:java-property-name" minOccurs="0"/>
  +          <xs:element name="getter" type="tns:java-method-name"/>
  +          <xs:element name="setter" type="tns:java-method-name" minOccurs="0"/>
           </xs:sequence>
           <xs:element name="field" type="tns:java-field-name"/>
           <xs:element name="static" type="tns:java-field-name"/>
  @@ -140,6 +140,13 @@
       <xs:restriction base="xs:token">
       </xs:restriction>
     </xs:simpleType>
  +
  +  <xs:complexType name="java-method-name">
  +    <xs:sequence>
  +      <xs:element name="method-name" type="xs:token" minOccurs="1"/>
  +      <xs:element name="param-type" type="tns:java-class-name" minOccurs="0" maxOccurs="unbounded"/>
  +    </xs:sequence>
  +  </xs:complexType>
   
     <xs:simpleType name="xml-signature">
       <xs:restriction base="xs:token">
  
  
  
  1.3       +31 -8     xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/internal/PrimitiveJClass.java
  
  Index: PrimitiveJClass.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/internal/PrimitiveJClass.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PrimitiveJClass.java	3 Dec 2003 22:46:15 -0000	1.2
  +++ PrimitiveJClass.java	16 Dec 2003 09:55:05 -0000	1.3
  @@ -82,24 +82,30 @@
       {"double", "D", double.class},
     };
   
  -  private static final Map NAME_TO_CLASS, FD_TO_CLASS;
  +  private static final Map NAME_TO_JCLASS, FD_TO_JCLASS,
  +  NAME_TO_FD, NAME_TO_CLASS;
   
     static {
  +    NAME_TO_JCLASS = new HashMap();
  +    FD_TO_JCLASS = new HashMap();
  +    NAME_TO_FD = new HashMap();
       NAME_TO_CLASS = new HashMap();
  -    FD_TO_CLASS = new HashMap();
       for (int i = 0; i < PRIMITIVES.length; i++) {
         PrimitiveJClass c = new PrimitiveJClass
                 ((String) PRIMITIVES[i][0],
                         (String) PRIMITIVES[i][1],
                         (Class) PRIMITIVES[i][2]);
  -      NAME_TO_CLASS.put(c.getQualifiedName(), c);
  -      FD_TO_CLASS.put(c.getFieldDescriptor(), c);
  +      NAME_TO_JCLASS.put(c.getQualifiedName(), c);
  +      FD_TO_JCLASS.put(c.getFieldDescriptor(), c);
  +      NAME_TO_FD.put(PRIMITIVES[i][0],PRIMITIVES[i][1]);
  +      NAME_TO_CLASS.put(PRIMITIVES[i][0],PRIMITIVES[i][2]);
       }
     };
   
     // ========================================================================
     // Factory methods
   
  +
     /**
      * Returns a JClass representing the named primitive type.  The name
      * parameter can be a simple type name (e.g. 'int') or a field
  @@ -107,9 +113,9 @@
      * name a primitive type.
      */
     public static JClass getPrimitiveClassForName(String named) {
  -    JClass out = (JClass) NAME_TO_CLASS.get(named);
  +    JClass out = (JClass) NAME_TO_JCLASS.get(named);
       if (out != null) return out;
  -    return (JClass) FD_TO_CLASS.get(named);
  +    return (JClass) FD_TO_JCLASS.get(named);
     }
   
     /**
  @@ -129,8 +135,25 @@
      * (e.g. 'I').
      */
     public static boolean isPrimitive(String name) {
  -    return (NAME_TO_CLASS.get(name) != null ||
  -            FD_TO_CLASS.get(name) != null);
  +    return (NAME_TO_JCLASS.get(name) != null ||
  +            FD_TO_JCLASS.get(name) != null);
  +  }
  +
  +  /**
  +   * Returns the field descriptor for the given name, e.g. 'int' returns
  +   * 'I'.
  +   */
  +  public static final String getFieldDescriptor(String classname) {
  +    return (String)NAME_TO_FD.get(classname);
  +  }
  +
  +  /**
  +   * Returns the primitve class for the given name, e.g. 'int' returns
  +   * int.class.  It's really stupid that there isn't a way to deal
  +   * with this built in to java.
  +   */
  +  public static final Class getPrimitiveClass(String classname) {
  +    return (Class)NAME_TO_CLASS.get(classname);
     }
   
   
  
  
  
  1.3       +3 -3      xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/internal/javadoc/JDClassLoader.java
  
  Index: JDClassLoader.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/internal/javadoc/JDClassLoader.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JDClassLoader.java	3 Dec 2003 22:46:15 -0000	1.2
  +++ JDClassLoader.java	16 Dec 2003 09:55:05 -0000	1.3
  @@ -118,10 +118,10 @@
         if (out != null) return out;
         ClassDoc jc = mRootDoc.classNamed(fd);
         if (jc != null) {
  -	mFd2Class.put(fd,out = JDFactory.getInstance().createClass(jc,this));
  -	return out;
  +        mFd2Class.put(fd,out = JDFactory.getInstance().createClass(jc,this));
  +        return out;
         } else {
  -	return mParentLoader.loadClass(fd);
  +        return mParentLoader.loadClass(fd);
         }
       }
     }
  
  
  
  1.7       +8 -5      xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/internal/javadoc/JDClassLoaderFactory.java
  
  Index: JDClassLoaderFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/internal/javadoc/JDClassLoaderFactory.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JDClassLoaderFactory.java	3 Dec 2003 22:46:15 -0000	1.6
  +++ JDClassLoaderFactory.java	16 Dec 2003 09:55:05 -0000	1.7
  @@ -121,9 +121,13 @@
       argList.toArray(args);
       // create a buffer to capture the crap javadoc spits out.  we'll
       // just ignore it unless something goes wrong
  -    StringWriter spew = new StringWriter();
  -    PrintWriter spewWriter = new PrintWriter(System.out);
  -
  +    PrintWriter spewWriter;
  +    StringWriter spew = null;
  +    if (out == null) {
  +      spewWriter = new PrintWriter(spew = new StringWriter());
  +    } else {
  +      spewWriter = out;
  +    }
       JavadocResults.prepare();
       int result = com.sun.tools.javadoc.Main.execute("JAM",
                                                       spewWriter,
  @@ -136,14 +140,13 @@
         spewWriter.flush();
         throw new RuntimeException("Unknown javadoc problem: result="+result+
                                    ", root="+root+":\n"+
  -                                 spew.toString());
  +                                 ((spew == null) ? "" : spew.toString()));
       }
       return JDFactory.getInstance().createClassLoader(root,parentLoader);
     }
   
     // ========================================================================
     // Doclet 'implementation'
  -
   
     public static boolean start(RootDoc root) {
       JavadocResults.setRoot(root);
  
  
  
  1.3       +15 -17    xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/internal/reflect/RClassLoader.java
  
  Index: RClassLoader.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/jam/org/apache/xmlbeans/impl/jam/internal/reflect/RClassLoader.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RClassLoader.java	3 Dec 2003 22:46:16 -0000	1.2
  +++ RClassLoader.java	16 Dec 2003 09:55:05 -0000	1.3
  @@ -109,8 +109,6 @@
       if (fd == null) throw new IllegalArgumentException("null fd");
       //
       //FIXME we should do some more work here to make sure that
  -
  -
       fd = fd.trim();
       // check cache first
       JClass out = (JClass)mFd2Class.get(fd);
  @@ -170,29 +168,29 @@
     // ========================================================================
     // Private methods
   
  -  private void validateClassName(String className) 
  -    throws IllegalArgumentException 
  +  private void validateClassName(String className)
  +          throws IllegalArgumentException
     {
       if (!Character.isJavaIdentifierStart(className.charAt(0))) {
         throw new IllegalArgumentException
  -	("Invalid first character in class name: "+className);
  +              ("Invalid first character in class name: "+className);
       }
       for(int i=1; i<className.length(); i++) {
         char c = className.charAt(i);
         if (c == '.') {
  -	if (className.charAt(i-1) == '.') {
  -	  throw new IllegalArgumentException
  -	    ("'..' not allowed in class name: "+className);
  -	}
  -	if (i == className.length()-1) {
  -	  throw new IllegalArgumentException
  -	    ("'.' not allowed at end of class name: "+className);
  -	}
  +        if (className.charAt(i-1) == '.') {
  +          throw new IllegalArgumentException
  +                  ("'..' not allowed in class name: "+className);
  +        }
  +        if (i == className.length()-1) {
  +          throw new IllegalArgumentException
  +                  ("'.' not allowed at end of class name: "+className);
  +        }
         } else {
  -	if (!Character.isJavaIdentifierPart(c)) {
  -	  throw new IllegalArgumentException
  -	    ("Illegal character '"+c+"' in class name: "+className);
  -	}
  +        if (!Character.isJavaIdentifierPart(c)) {
  +          throw new IllegalArgumentException
  +                  ("Illegal character '"+c+"' in class name: "+className);
  +        }
         }
       }
     }
  
  
  
  1.13      +11 -12    xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ByNameRuntimeBindingType.java
  
  Index: ByNameRuntimeBindingType.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ByNameRuntimeBindingType.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ByNameRuntimeBindingType.java	15 Dec 2003 05:03:30 -0000	1.12
  +++ ByNameRuntimeBindingType.java	16 Dec 2003 09:55:06 -0000	1.13
  @@ -57,13 +57,7 @@
   package org.apache.xmlbeans.impl.marshal;
   
   import org.apache.xmlbeans.XmlRuntimeException;
  -import org.apache.xmlbeans.impl.binding.bts.BindingLoader;
  -import org.apache.xmlbeans.impl.binding.bts.BindingProperty;
  -import org.apache.xmlbeans.impl.binding.bts.BindingType;
  -import org.apache.xmlbeans.impl.binding.bts.BindingTypeName;
  -import org.apache.xmlbeans.impl.binding.bts.ByNameBean;
  -import org.apache.xmlbeans.impl.binding.bts.JavaTypeName;
  -import org.apache.xmlbeans.impl.binding.bts.QNameProperty;
  +import org.apache.xmlbeans.impl.binding.bts.*;
   import org.apache.xmlbeans.impl.marshal.util.collections.Accumulator;
   import org.apache.xmlbeans.impl.marshal.util.collections.AccumulatorFactory;
   
  @@ -468,10 +462,9 @@
                                                 Class beanClass,
                                                 Class propClass)
           {
  -            String setter = binding_prop.getSetterName();
  +            MethodName setterName = binding_prop.getSetterName();
               try {
  -                final Method set_method =
  -                    beanClass.getMethod(setter, new Class[]{propClass});
  +                final Method set_method = setterName.getMethodOn(beanClass);
                   return set_method;
               }
               catch (NoSuchMethodException e) {
  @@ -480,16 +473,19 @@
               catch (SecurityException e) {
                   throw new XmlRuntimeException(e);
               }
  +            catch (ClassNotFoundException cnfe) {
  +                throw new XmlRuntimeException(cnfe);
  +            }
           }
   
   
           private static Method getGetterMethod(QNameProperty binding_prop,
                                                 Class beanClass)
           {
  -            String getter = binding_prop.getGetterName();
  +            MethodName getterName = binding_prop.getGetterName();
               try {
                   final Method get_method =
  -                    beanClass.getMethod(getter, EMPTY_CLASS_ARRAY);
  +                    getterName.getMethodOn(beanClass);
                   return get_method;
               }
               catch (NoSuchMethodException e) {
  @@ -497,6 +493,9 @@
               }
               catch (SecurityException e) {
                   throw new XmlRuntimeException(e);
  +            }
  +            catch (ClassNotFoundException cnfe) {
  +                throw new XmlRuntimeException(cnfe);//should never happen
               }
           }
   
  
  
  
  1.13      +91 -26    xml-xmlbeans/v2/test/cases/marshal/example_config.xml
  
  Index: example_config.xml
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/test/cases/marshal/example_config.xml,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- example_config.xml	15 Dec 2003 05:03:32 -0000	1.12
  +++ example_config.xml	16 Dec 2003 09:55:06 -0000	1.13
  @@ -13,30 +13,50 @@
               <bin:qname-property>
                   <bin:xmlcomponent>t=float@http://www.w3.org/2001/XMLSchema</bin:xmlcomponent>
                   <bin:javatype>float</bin:javatype>
  -                <bin:getter>getAttrib</bin:getter>
  -                <bin:setter>setAttrib</bin:setter>
  +                <bin:getter>
  +                   <bin:method-name>getAttrib</bin:method-name>
  +                </bin:getter>
  +                <bin:setter>
  +                   <bin:method-name>setAttrib</bin:method-name>
  +                   <bin:param-type>float</bin:param-type>
  +                </bin:setter>
                   <bin:qname>java:Attrib</bin:qname>
                   <bin:attribute>true</bin:attribute>
               </bin:qname-property>
               <bin:qname-property>
                   <bin:xmlcomponent>t=MyClass@java:com.mytest</bin:xmlcomponent>
                   <bin:javatype>com.mytest.MyClass</bin:javatype>
  -                <bin:getter>getMyClass</bin:getter>
  -                <bin:setter>setMyClass</bin:setter>
  +                <bin:getter>
  +                   <bin:method-name>getMyClass</bin:method-name>
  +                </bin:getter>
  +                <bin:setter>
  +                   <bin:method-name>setMyClass</bin:method-name>
  +                   <bin:param-type>com.mytest.MyClass</bin:param-type>
  +                </bin:setter>
                   <bin:qname>java:MyClass</bin:qname>
               </bin:qname-property>
               <bin:qname-property>
                   <bin:xmlcomponent>t=float@http://www.w3.org/2001/XMLSchema</bin:xmlcomponent>
                   <bin:javatype>float</bin:javatype>
  -                <bin:getter>getMyFloat</bin:getter>
  -                <bin:setter>setMyFloat</bin:setter>
  +                <bin:getter>
  +                   <bin:method-name>getMyFloat</bin:method-name>
  +                </bin:getter>
  +                <bin:setter>
  +                   <bin:method-name>setMyFloat</bin:method-name>
  +                   <bin:param-type>float</bin:param-type>
  +                </bin:setter>
                   <bin:qname>java:MyFloat</bin:qname>
               </bin:qname-property>
               <bin:qname-property>
                   <bin:xmlcomponent>t=MyClass@java:com.mytest</bin:xmlcomponent>
                   <bin:javatype>com.mytest.MyClass</bin:javatype>
  -                <bin:getter>getMyClassArray</bin:getter>
  -                <bin:setter>setMyClassArray</bin:setter>
  +                <bin:getter>
  +                   <bin:method-name>getMyClassArray</bin:method-name>
  +                </bin:getter>
  +                <bin:setter>
  +                   <bin:method-name>setMyClassArray</bin:method-name>
  +                   <bin:param-type>com.mytest.MyClass[]</bin:param-type>
  +                </bin:setter>
                   <bin:collection>com.mytest.MyClass[]</bin:collection>
                   <bin:qname>java:MyClassArray</bin:qname>
                   <bin:multiple>true</bin:multiple>
  @@ -44,8 +64,13 @@
               <bin:qname-property>
                   <bin:xmlcomponent>t=long@http://www.w3.org/2001/XMLSchema</bin:xmlcomponent>
                   <bin:javatype>long</bin:javatype>
  -                <bin:getter>getLongArray</bin:getter>
  -                <bin:setter>setLongArray</bin:setter>
  +                <bin:getter>
  +                   <bin:method-name>getLongArray</bin:method-name>
  +                </bin:getter>
  +                <bin:setter>
  +                   <bin:method-name>setLongArray</bin:method-name>
  +                   <bin:param-type>long[]</bin:param-type>
  +                </bin:setter>
                   <bin:collection>long[]</bin:collection>
                   <bin:qname>java:LongArray</bin:qname>
                   <bin:multiple>true</bin:multiple>
  @@ -53,15 +78,25 @@
               <bin:qname-property>
                   <bin:xmlcomponent>t=boolean@http://www.w3.org/2001/XMLSchema</bin:xmlcomponent>
                   <bin:javatype>boolean</bin:javatype>
  -                <bin:getter>isSomeBool</bin:getter>
  -                <bin:setter>setSomeBool</bin:setter>
  +                <bin:getter>
  +                   <bin:method-name>isSomeBool</bin:method-name>
  +                </bin:getter>
  +                <bin:setter>
  +                   <bin:method-name>setSomeBool</bin:method-name>
  +                   <bin:param-type>boolean</bin:param-type>
  +                </bin:setter>
                   <bin:qname>java:SomeBool</bin:qname>
               </bin:qname-property>
               <bin:qname-property>
                   <bin:xmlcomponent>t=boolean@http://www.w3.org/2001/XMLSchema</bin:xmlcomponent>
                   <bin:javatype>boolean</bin:javatype>
  -                <bin:getter>getBooleanArray</bin:getter>
  -                <bin:setter>setBooleanArray</bin:setter>
  +                <bin:getter>
  +                   <bin:method-name>getBooleanArray</bin:method-name>
  +                </bin:getter>
  +                <bin:setter>
  +                   <bin:method-name>setBooleanArray</bin:method-name>
  +                   <bin:param-type>boolean[]</bin:param-type>
  +                </bin:setter>
                   <bin:collection>boolean[]</bin:collection>
                   <bin:qname>java:BooleanArray</bin:qname>
                   <bin:multiple>true</bin:multiple>
  @@ -69,8 +104,13 @@
               <bin:qname-property>
                   <bin:xmlcomponent>t=string@http://www.w3.org/2001/XMLSchema</bin:xmlcomponent>
                   <bin:javatype>java.lang.String</bin:javatype>
  -                <bin:getter>getStringArray</bin:getter>
  -                <bin:setter>setStringArray</bin:setter>
  +                <bin:getter>
  +                   <bin:method-name>getStringArray</bin:method-name>
  +                </bin:getter>
  +                <bin:setter>
  +                   <bin:method-name>setStringArray</bin:method-name>
  +                   <bin:param-type>java.lang.String[]</bin:param-type>
  +                </bin:setter>
                   <bin:collection>java.lang.String[]</bin:collection>
                   <bin:qname>java:StringArray</bin:qname>
                   <bin:multiple>true</bin:multiple>
  @@ -82,15 +122,25 @@
               <bin:qname-property>
                   <bin:xmlcomponent>t=YourClass@java:com.mytest</bin:xmlcomponent>
                   <bin:javatype>com.mytest.YourClass</bin:javatype>
  -                <bin:getter>getMyelt</bin:getter>
  -                <bin:setter>setMyelt</bin:setter>
  +                <bin:getter>
  +                   <bin:method-name>getMyelt</bin:method-name>
  +                </bin:getter>
  +                <bin:setter>
  +                   <bin:method-name>setMyelt</bin:method-name>
  +                   <bin:param-type>com.mytest.YourClass</bin:param-type>
  +                </bin:setter>
                   <bin:qname>java:Myelt</bin:qname>
               </bin:qname-property>
               <bin:qname-property>
                   <bin:xmlcomponent>t=string@http://www.w3.org/2001/XMLSchema</bin:xmlcomponent>
                   <bin:javatype>java.lang.String</bin:javatype>
  -                <bin:getter>getMyatt</bin:getter>
  -                <bin:setter>setMyatt</bin:setter>
  +                <bin:getter>
  +                   <bin:method-name>getMyatt</bin:method-name>
  +                </bin:getter>
  +                <bin:setter>
  +                   <bin:method-name>setMyatt</bin:method-name>
  +                   <bin:param-type>java.lang.String</bin:param-type>
  +                </bin:setter>
                   <bin:qname>java:Myatt</bin:qname>
                   <bin:nillable>true</bin:nillable>
               </bin:qname-property>
  @@ -106,23 +156,38 @@
               <bin:qname-property>
                   <bin:xmlcomponent>t=YourClass@java:com.mytest</bin:xmlcomponent>
                   <bin:javatype>com.mytest.YourClass</bin:javatype>
  -                <bin:getter>getMyelt</bin:getter>
  -                <bin:setter>setMyelt</bin:setter>
  +                <bin:getter>
  +                   <bin:method-name>getMyelt</bin:method-name>
  +                </bin:getter>
  +                <bin:setter>
  +                   <bin:method-name>setMyelt</bin:method-name>
  +                   <bin:param-type>com.mytest.YourClass</bin:param-type>
  +                </bin:setter>
                   <bin:qname>java:Myelt</bin:qname>
               </bin:qname-property>
               <bin:qname-property>
                   <bin:xmlcomponent>t=string@http://www.w3.org/2001/XMLSchema</bin:xmlcomponent>
                   <bin:javatype>java.lang.String</bin:javatype>
  -                <bin:getter>getMyatt</bin:getter>
  -                <bin:setter>setMyatt</bin:setter>
  +                <bin:getter>
  +                   <bin:method-name>getMyatt</bin:method-name>
  +                </bin:getter>
  +                <bin:setter>
  +                   <bin:method-name>setMyatt</bin:method-name>
  +                   <bin:param-type>java.lang.String</bin:param-type>
  +                </bin:setter>
                   <bin:qname>java:Myatt</bin:qname>
                   <bin:nillable>true</bin:nillable>
               </bin:qname-property>
               <bin:qname-property>
                   <bin:xmlcomponent>t=integer@http://www.w3.org/2001/XMLSchema</bin:xmlcomponent>
                   <bin:javatype>java.math.BigInteger</bin:javatype>
  -                <bin:getter>getBigInt</bin:getter>
  -                <bin:setter>setBigInt</bin:setter>
  +                <bin:getter>
  +                   <bin:method-name>getBigInt</bin:method-name>
  +                </bin:getter>
  +                <bin:setter>
  +                   <bin:method-name>setBigInt</bin:method-name>
  +                   <bin:param-type>java.math.BigInteger</bin:param-type>
  +                </bin:setter>
                   <bin:qname>java:BigInt</bin:qname>
               </bin:qname-property>
           </bin:binding-type>
  
  
  
  1.14      +42 -31    xml-xmlbeans/v2/test/src/drt/drtcases/BindingTests.java
  
  Index: BindingTests.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/test/src/drt/drtcases/BindingTests.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- BindingTests.java	13 Dec 2003 07:56:52 -0000	1.13
  +++ BindingTests.java	16 Dec 2003 09:55:06 -0000	1.14
  @@ -9,17 +9,7 @@
   import junit.framework.Test;
   import junit.framework.TestCase;
   import junit.framework.TestSuite;
  -import org.apache.xmlbeans.impl.binding.bts.BindingFile;
  -import org.apache.xmlbeans.impl.binding.bts.BindingLoader;
  -import org.apache.xmlbeans.impl.binding.bts.BindingType;
  -import org.apache.xmlbeans.impl.binding.bts.BuiltinBindingLoader;
  -import org.apache.xmlbeans.impl.binding.bts.ByNameBean;
  -import org.apache.xmlbeans.impl.binding.bts.JavaTypeName;
  -import org.apache.xmlbeans.impl.binding.bts.PathBindingLoader;
  -import org.apache.xmlbeans.impl.binding.bts.QNameProperty;
  -import org.apache.xmlbeans.impl.binding.bts.SimpleBindingType;
  -import org.apache.xmlbeans.impl.binding.bts.XmlTypeName;
  -import org.apache.xmlbeans.impl.binding.bts.BindingTypeName;
  +import org.apache.xmlbeans.impl.binding.bts.*;
   import org.apache.xmlbeans.impl.binding.compile.Schema2Java;
   import org.apache.xmlbeans.impl.binding.compile.SchemaSourceSet;
   import org.apache.xmlbeans.impl.binding.compile.SimpleSourceSet;
  @@ -114,22 +104,22 @@
   
           QNameProperty prop = new QNameProperty();
           prop.setQName(new QName("http://www.mytest.com/", "myelt"));
  -        prop.setSetterName("setMyelt");
  -        prop.setGetterName("getMyelt");
  +        prop.setSetterName(createSetterName("setMyelt",bnb2.getName()));
  +        prop.setGetterName(createGetterName("getMyelt"));
           prop.setBindingType(bnb2);
           bnb.addProperty(prop);
   
           prop = new QNameProperty();
           prop.setQName(new QName("http://www.mytest.com/", "myelt2"));
  -        prop.setSetterName("setMyelt2");
  -        prop.setGetterName("getMyelt2");
  +        prop.setSetterName(createSetterName("setMyelt2",bnb.getName()));
  +        prop.setGetterName(createGetterName("getMyelt2"));
           prop.setBindingType(bnb);
           bnb.addProperty(prop);
   
           prop = new QNameProperty();
           prop.setQName(new QName("http://www.mytest.com/", "myatt"));
  -        prop.setSetterName("setMyatt");
  -        prop.setGetterName("getMyatt");
  +        prop.setSetterName(createSetterName("setMyatt",sbt.getName()));
  +        prop.setGetterName(createGetterName("getMyatt"));
           prop.setBindingType(sbt);
           bnb.addProperty(prop);
   
  @@ -137,15 +127,15 @@
   
           prop = new QNameProperty();
           prop.setQName(new QName("http://www.mytest.com/", "yourelt"));
  -        prop.setSetterName("setYourelt");
  -        prop.setGetterName("getYourelt");
  +        prop.setSetterName(createSetterName("setYourelt",bnb2.getName()));
  +        prop.setGetterName(createGetterName("getYourelt"));
           prop.setBindingType(bnb2);
           bnb2.addProperty(prop);
   
           prop = new QNameProperty();
           prop.setQName(new QName("http://www.mytest.com/", "yourelt2"));
  -        prop.setSetterName("setYourelt2");
  -        prop.setGetterName("getYourelt2");
  +        prop.setSetterName(createSetterName("setYourelt2",bnb.getName()));
  +        prop.setGetterName(createGetterName("getYourelt2"));
           prop.setBindingType(bnb);
           bnb2.addProperty(prop);
   
  @@ -188,32 +178,53 @@
   
           // check bnb
           prop = bnbc.getPropertyForElement(new QName("http://www.mytest.com/", "myelt"));
  -        Assert.assertEquals("setMyelt", prop.getSetterName());
  -        Assert.assertEquals("getMyelt", prop.getGetterName());
  +        Assert.assertEquals(createSetterName("setMyelt",prop.getTypeName()),
  +                            prop.getSetterName());
  +        Assert.assertEquals(createGetterName("getMyelt"),
  +                            prop.getGetterName());
           Assert.assertEquals(bnb2c, lc.getBindingType(prop.getTypeName()));
   
           prop = bnbc.getPropertyForElement(new QName("http://www.mytest.com/", "myelt2"));
  -        Assert.assertEquals("setMyelt2", prop.getSetterName());
  -        Assert.assertEquals("getMyelt2", prop.getGetterName());
  +        Assert.assertEquals(createSetterName("setMyelt2",prop.getTypeName()),
  +                            prop.getSetterName());
  +        Assert.assertEquals(createGetterName("getMyelt2"), prop.getGetterName());
           Assert.assertEquals(bnbc, lc.getBindingType(prop.getTypeName()));
   
           prop = bnbc.getPropertyForElement(new QName("http://www.mytest.com/", "myatt"));
  -        Assert.assertEquals("setMyatt", prop.getSetterName());
  -        Assert.assertEquals("getMyatt", prop.getGetterName());
  +        Assert.assertEquals(createSetterName("setMyatt",prop.getTypeName()),
  +                            prop.getSetterName());
  +        Assert.assertEquals(createGetterName("getMyatt"), prop.getGetterName());
           Assert.assertEquals(sbtc, lc.getBindingType(prop.getTypeName()));
   
           // check bnb2
           prop = bnb2c.getPropertyForElement(new QName("http://www.mytest.com/", "yourelt"));
  -        Assert.assertEquals("setYourelt", prop.getSetterName());
  -        Assert.assertEquals("getYourelt", prop.getGetterName());
  +        Assert.assertEquals(createSetterName("setYourelt", prop.getTypeName()),
  +                                             prop.getSetterName());
  +        Assert.assertEquals(createGetterName("getYourelt"), prop.getGetterName());
           Assert.assertEquals(bnb2c, lc.getBindingType(prop.getTypeName()));
   
           prop = bnb2c.getPropertyForElement(new QName("http://www.mytest.com/", "yourelt2"));
  -        Assert.assertEquals("setYourelt2", prop.getSetterName());
  -        Assert.assertEquals("getYourelt2", prop.getGetterName());
  +        Assert.assertEquals(createSetterName("setYourelt2",prop.getTypeName()),
  +                            prop.getSetterName());
  +        Assert.assertEquals(createGetterName("getYourelt2"), prop.getGetterName());
           Assert.assertEquals(bnbc, lc.getBindingType(prop.getTypeName()));
   
           // check sbtc
           Assert.assertEquals(XmlTypeName.forString("t=string@http://www.w3.org/2001/XMLSchema"), sbtc.getAsIfXmlType());
       }
  +
  +  /**
  +   * Utility method for building up method names in the binding file.
  +   */
  +  private static MethodName createGetterName(String methodName) {
  +    return MethodName.create(methodName);
  +  }
  +
  +  /**
  +   * Utility method for building up method names in the binding file.
  +   */
  +  private static MethodName createSetterName(String methodName, BindingTypeName bt) {
  +    return MethodName.create(methodName,
  +                             bt.getJavaName());
  +  }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org


Mime
View raw message