xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From z...@apache.org
Subject cvs commit: xml-xmlbeans/v2/test/cases/marshal/com/mytest YourClass.java
Date Wed, 21 Apr 2004 22:08:03 GMT
zieg        2004/04/21 15:08:03

  Modified:    v2/src/binding/org/apache/xmlbeans/impl/binding/bts
                        BindingProperty.java
               v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections
                        AccumulatorFactory.java
                        ArrayListBasedObjectAccumulator.java
                        BooleanList.java ByteList.java CharList.java
                        DoubleList.java FloatList.java
                        GenericCollectionObjectAccumulator.java
                        HashSetBasedObjectAccumulator.java IntList.java
                        LinkedListBasedObjectAccumulator.java LongList.java
                        ObjectAccumulator.java ShortList.java
                        StackBasedObjectAccumulator.java StringList.java
                        TreeSetBasedObjectAccumulator.java
                        VectorBasedObjectAccumulator.java
               v2/test/cases/marshal example_config.xml
               v2/test/cases/marshal/com/mytest YourClass.java
  Log:
  cleanup collection handling
  
  Revision  Changes    Path
  1.17      +3 -0      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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- BindingProperty.java	25 Mar 2004 22:00:28 -0000	1.16
  +++ BindingProperty.java	21 Apr 2004 22:08:03 -0000	1.17
  @@ -97,6 +97,9 @@
           if (getSetterName() != null) {
               getSetterName().write(node.addNewSetter());
           }
  +        if (getIssetterName() != null) {
  +            getIssetterName().write(node.addNewIssetter());
  +        }
           if (getCollectionClass() != null)
               node.setCollection(getCollectionClass().toString());
   
  
  
  
  1.4       +10 -21    xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/AccumulatorFactory.java
  
  Index: AccumulatorFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/AccumulatorFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AccumulatorFactory.java	12 Feb 2004 20:06:18 -0000	1.3
  +++ AccumulatorFactory.java	21 Apr 2004 22:08:03 -0000	1.4
  @@ -35,7 +35,8 @@
               return new StringList(initial_capacity);
           } else {
               return new ArrayListBasedObjectAccumulator(component_type,
  -                                                       initial_capacity);
  +                                                       initial_capacity,
  +                                                       false);
           }
       }
   
  @@ -90,60 +91,48 @@
                                                              Class component_type,
                                                              int initial_capacity)
       {
  -
  -        final boolean return_collection = !container_type.isArray();
  +        assert !container_type.isArray();
   
   
           if (java.util.Collection.class.equals(container_type) ||
               java.util.ArrayList.class.equals(container_type) ||
               java.util.List.class.equals(container_type)) {
               return new ArrayListBasedObjectAccumulator(component_type,
  -                                                       initial_capacity,
  -                                                       return_collection);
  +                                                       initial_capacity);
           }
   
   
           if (java.util.Set.class.equals(container_type) ||
               java.util.HashSet.class.equals(container_type)) {
               return new HashSetBasedObjectAccumulator(component_type,
  -                                                     initial_capacity,
  -                                                     return_collection);
  +                                                     initial_capacity);
           }
   
   
           if (java.util.SortedSet.class.equals(container_type) ||
               java.util.TreeSet.class.equals(container_type)) {
               return new TreeSetBasedObjectAccumulator(component_type,
  -                                                     initial_capacity,
  -                                                     return_collection);
  +                                                     initial_capacity);
           }
   
   
           if (java.util.Vector.class.equals(container_type)) {
               return new VectorBasedObjectAccumulator(component_type,
  -                                                    initial_capacity,
  -                                                    return_collection);
  +                                                    initial_capacity);
           }
   
           if (java.util.Stack.class.equals(container_type)) {
               return new StackBasedObjectAccumulator(component_type,
  -                                                   initial_capacity,
  -                                                   return_collection);
  +                                                   initial_capacity);
           }
   
           if (java.util.LinkedList.class.equals(container_type)) {
               return new LinkedListBasedObjectAccumulator(component_type,
  -                                                        initial_capacity,
  -                                                        return_collection);
  +                                                        initial_capacity);
           }
   
  -
           return new GenericCollectionObjectAccumulator(container_type,
  -                                                      component_type,
  -                                                      initial_capacity,
  -                                                      return_collection);
  -
  -
  +                                                      component_type);
       }
   
   
  
  
  
  1.4       +1 -7      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/ArrayListBasedObjectAccumulator.java
  
  Index: ArrayListBasedObjectAccumulator.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/ArrayListBasedObjectAccumulator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ArrayListBasedObjectAccumulator.java	12 Feb 2004 20:06:18 -0000	1.3
  +++ ArrayListBasedObjectAccumulator.java	21 Apr 2004 22:08:03 -0000	1.4
  @@ -31,16 +31,10 @@
           super(component_type, initial_capacity, return_collection);
       }
   
  -
       public ArrayListBasedObjectAccumulator(Class component_type,
                                              int initial_capacity)
       {
  -        super(component_type, initial_capacity);
  -    }
  -
  -    public ArrayListBasedObjectAccumulator(Class component_type)
  -    {
  -        super(component_type);
  +        this(component_type, initial_capacity, true);
       }
   
       protected Collection createNewStore(int capacity)
  
  
  
  1.4       +0 -9      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/BooleanList.java
  
  Index: BooleanList.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/BooleanList.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BooleanList.java	12 Feb 2004 20:06:18 -0000	1.3
  +++ BooleanList.java	21 Apr 2004 22:08:03 -0000	1.4
  @@ -41,15 +41,6 @@
       }
   
       /**
  -     get array used as backing store.  do not modify this array.
  -     effeciency wins here vs. safety.
  -     */
  -    public boolean[] getStore()
  -    {
  -        return store;
  -    }
  -
  -    /**
        get a new array just large enough to hold the items
        */
       public boolean[] getMinSizedArray()
  
  
  
  1.4       +0 -9      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/ByteList.java
  
  Index: ByteList.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/ByteList.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ByteList.java	12 Feb 2004 20:06:18 -0000	1.3
  +++ ByteList.java	21 Apr 2004 22:08:03 -0000	1.4
  @@ -41,15 +41,6 @@
       }
   
       /**
  -     get array used as backing store.  do not modify this array.
  -     effeciency wins here vs. safety.
  -     */
  -    public byte[] getStore()
  -    {
  -        return store;
  -    }
  -
  -    /**
        get a new array just large enough to hold the items
        */
       public byte[] getMinSizedArray()
  
  
  
  1.4       +0 -9      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/CharList.java
  
  Index: CharList.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/CharList.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CharList.java	12 Feb 2004 20:06:18 -0000	1.3
  +++ CharList.java	21 Apr 2004 22:08:03 -0000	1.4
  @@ -40,15 +40,6 @@
           store = new char[initial_capacity];
       }
   
  -    /**
  -     get array used as backing store.  do not modify this array.
  -     effeciency wins here vs. safety.
  -     */
  -    public char[] getStore()
  -    {
  -        return store;
  -    }
  -
       public Object getFinalArray()
       {
           return getMinSizedArray();
  
  
  
  1.4       +0 -9      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/DoubleList.java
  
  Index: DoubleList.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/DoubleList.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DoubleList.java	12 Feb 2004 20:06:18 -0000	1.3
  +++ DoubleList.java	21 Apr 2004 22:08:03 -0000	1.4
  @@ -38,15 +38,6 @@
           store = new double[initial_capacity];
       }
   
  -    /**
  -     get array used as backing store.  do not modify this array.
  -     effeciency wins here vs. safety.
  -     */
  -    public double[] getStore()
  -    {
  -        return store;
  -    }
  -
       public Object getFinalArray()
       {
           return getMinSizedArray();
  
  
  
  1.4       +0 -9      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/FloatList.java
  
  Index: FloatList.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/FloatList.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FloatList.java	12 Feb 2004 20:06:18 -0000	1.3
  +++ FloatList.java	21 Apr 2004 22:08:03 -0000	1.4
  @@ -40,15 +40,6 @@
           store = new float[initial_capacity];
       }
   
  -    /**
  -     get array used as backing store.  do not modify this array.
  -     effeciency wins here vs. safety.
  -     */
  -    public float[] getStore()
  -    {
  -        return store;
  -    }
  -
       public Object getFinalArray()
       {
           return getMinSizedArray();
  
  
  
  1.3       +19 -15    xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/GenericCollectionObjectAccumulator.java
  
  Index: GenericCollectionObjectAccumulator.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/GenericCollectionObjectAccumulator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- GenericCollectionObjectAccumulator.java	12 Feb 2004 20:06:18 -0000	1.2
  +++ GenericCollectionObjectAccumulator.java	21 Apr 2004 22:08:03 -0000	1.3
  @@ -20,33 +20,37 @@
   
   
   public final class GenericCollectionObjectAccumulator
  -    extends ObjectAccumulator
  +    implements Accumulator
   {
  -    private final Class containerType;
  +    private final Class componentType;
  +    private final Collection container;
   
       public GenericCollectionObjectAccumulator(Class container_type,
  -                                              Class component_type,
  -                                              int initial_capacity,
  -                                              boolean return_collection)
  -    {
  -        super(component_type, initial_capacity, return_collection);
  -        containerType = container_type;
  -    }
  -
  -
  -    protected Collection createNewStore(int capacity)
  +                                              Class component_type)
       {
  +        assert Collection.class.isAssignableFrom(container_type);
  +        componentType = component_type;
           try {
  -            return (Collection)containerType.newInstance();
  +            container = (Collection)container_type.newInstance();
           }
           catch (InstantiationException e) {
  -            throw new RuntimeException(e);
  +            throw (IllegalArgumentException)(new IllegalArgumentException()).initCause(e);
           }
           catch (IllegalAccessException e) {
  -            throw new RuntimeException(e);
  +            throw (IllegalArgumentException)(new IllegalArgumentException()).initCause(e);
           }
       }
   
  +
  +    public void append(Object elem)
  +    {
  +        container.add(elem);
  +    }
  +
  +    public Object getFinalArray()
  +    {
  +        return container;
  +    }
   
   }
   
  
  
  
  1.3       +1 -15     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/HashSetBasedObjectAccumulator.java
  
  Index: HashSetBasedObjectAccumulator.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/HashSetBasedObjectAccumulator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HashSetBasedObjectAccumulator.java	12 Feb 2004 20:06:18 -0000	1.2
  +++ HashSetBasedObjectAccumulator.java	21 Apr 2004 22:08:03 -0000	1.3
  @@ -23,25 +23,11 @@
   public final class HashSetBasedObjectAccumulator
       extends ObjectAccumulator
   {
  -    private static final boolean ASSERT = false;
  -
  -
  -    public HashSetBasedObjectAccumulator(Class component_type,
  -                                         int initial_capacity,
  -                                         boolean return_collection)
  -    {
  -        super(component_type, initial_capacity, return_collection);
  -    }
   
       public HashSetBasedObjectAccumulator(Class component_type,
                                            int initial_capacity)
       {
  -        super(component_type, initial_capacity);
  -    }
  -
  -    public HashSetBasedObjectAccumulator(Class component_type)
  -    {
  -        super(component_type);
  +        super(component_type, initial_capacity, true);
       }
   
       protected Collection createNewStore(int capacity)
  
  
  
  1.4       +0 -10     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/IntList.java
  
  Index: IntList.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/IntList.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- IntList.java	12 Feb 2004 20:06:18 -0000	1.3
  +++ IntList.java	21 Apr 2004 22:08:03 -0000	1.4
  @@ -38,20 +38,10 @@
           store = new int[initial_capacity];
       }
   
  -    /**
  -     get array used as backing store.  do not modify this array.
  -     effeciency wins here vs. safety.
  -     */
  -    public int[] getStore()
  -    {
  -        return store;
  -    }
  -
       public Object getFinalArray()
       {
           return getMinSizedArray();
       }
  -
   
       /**
        get a new array just large enough to hold the items
  
  
  
  1.3       +1 -14     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/LinkedListBasedObjectAccumulator.java
  
  Index: LinkedListBasedObjectAccumulator.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/LinkedListBasedObjectAccumulator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LinkedListBasedObjectAccumulator.java	12 Feb 2004 20:06:18 -0000	1.2
  +++ LinkedListBasedObjectAccumulator.java	21 Apr 2004 22:08:03 -0000	1.3
  @@ -24,22 +24,9 @@
       extends ObjectAccumulator
   {
       public LinkedListBasedObjectAccumulator(Class component_type,
  -                                            int initial_capacity,
  -                                            boolean return_collection)
  -    {
  -        super(component_type, initial_capacity, return_collection);
  -    }
  -
  -
  -    public LinkedListBasedObjectAccumulator(Class component_type,
                                               int initial_capacity)
       {
  -        super(component_type, initial_capacity);
  -    }
  -
  -    public LinkedListBasedObjectAccumulator(Class component_type)
  -    {
  -        super(component_type);
  +        super(component_type, initial_capacity, true);
       }
   
       protected Collection createNewStore(int capacity)
  
  
  
  1.4       +0 -9      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/LongList.java
  
  Index: LongList.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/LongList.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LongList.java	12 Feb 2004 20:06:18 -0000	1.3
  +++ LongList.java	21 Apr 2004 22:08:03 -0000	1.4
  @@ -41,15 +41,6 @@
       }
   
       /**
  -     get array used as backing store.  do not modify this array.
  -     effeciency wins here vs. safety.
  -     */
  -    public long[] getStore()
  -    {
  -        return store;
  -    }
  -
  -    /**
        get a new array just large enough to hold the items
        */
       public long[] getMinSizedArray()
  
  
  
  1.6       +2 -12     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/ObjectAccumulator.java
  
  Index: ObjectAccumulator.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/ObjectAccumulator.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ObjectAccumulator.java	21 Apr 2004 05:29:41 -0000	1.5
  +++ ObjectAccumulator.java	21 Apr 2004 22:08:03 -0000	1.6
  @@ -32,12 +32,6 @@
                                int initial_capacity,
                                boolean return_collection)
       {
  -        if (!return_collection) {
  -            if (component_type.isPrimitive()) {
  -                throw new AssertionError("odd: " + component_type);
  -            }
  -        }
  -
           componentType = component_type;
           returnCollectionForArray = return_collection;
   
  @@ -62,17 +56,13 @@
       {
           assert checkInstance(o);
   
  -//        if (o != null && !componentType.isAssignableFrom(o.getClass())) {
  -//            String msg = "Invalid type: " + o.getClass().getName() +
  -//                " expecting: " + componentType.getName();
  -//            throw new IllegalArgumentException(msg);
  -//        }
  -
           store.add(o);
       }
   
       private boolean checkInstance(Object o)
       {
  +        if (o == null) return true;
  +        if (componentType.isPrimitive()) return true; // can't quite deal with this
           if (!componentType.isInstance(o)) {
               String msg = "Invalid type: " + o.getClass().getName() +
                   " expecting: " + componentType.getName();
  
  
  
  1.4       +0 -9      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/ShortList.java
  
  Index: ShortList.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/ShortList.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ShortList.java	12 Feb 2004 20:06:18 -0000	1.3
  +++ ShortList.java	21 Apr 2004 22:08:03 -0000	1.4
  @@ -40,15 +40,6 @@
           store = new short[initial_capacity];
       }
   
  -    /**
  -     get array used as backing store.  do not modify this array.
  -     effeciency wins here vs. safety.
  -     */
  -    public short[] getStore()
  -    {
  -        return store;
  -    }
  -
       public Object getFinalArray()
       {
           return getMinSizedArray();
  
  
  
  1.3       +1 -14     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/StackBasedObjectAccumulator.java
  
  Index: StackBasedObjectAccumulator.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/StackBasedObjectAccumulator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StackBasedObjectAccumulator.java	12 Feb 2004 20:06:18 -0000	1.2
  +++ StackBasedObjectAccumulator.java	21 Apr 2004 22:08:03 -0000	1.3
  @@ -24,22 +24,9 @@
       extends ObjectAccumulator
   {
       public StackBasedObjectAccumulator(Class component_type,
  -                                       int initial_capacity,
  -                                       boolean return_collection)
  -    {
  -        super(component_type, initial_capacity, return_collection);
  -    }
  -
  -
  -    public StackBasedObjectAccumulator(Class component_type,
                                          int initial_capacity)
       {
  -        super(component_type, initial_capacity);
  -    }
  -
  -    public StackBasedObjectAccumulator(Class component_type)
  -    {
  -        super(component_type);
  +        super(component_type, initial_capacity, true);
       }
   
       protected Collection createNewStore(int capacity)
  
  
  
  1.7       +2 -10     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/StringList.java
  
  Index: StringList.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/StringList.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StringList.java	12 Apr 2004 22:39:46 -0000	1.6
  +++ StringList.java	21 Apr 2004 22:08:03 -0000	1.7
  @@ -42,15 +42,6 @@
           store = new String[initial_capacity];
       }
   
  -    /**
  -     get array used as backing store.  do not modify this array.
  -     effeciency wins here vs. safety.
  -     */
  -    public String[] getStore()
  -    {
  -        return store;
  -    }
  -
       public Object getFinalArray()
       {
           return getMinSizedArray();
  @@ -81,7 +72,8 @@
           add((String)o);
       }
   
  -    public void clear() {
  +    public void clear()
  +    {
           Arrays.fill(store, null);
           size = 0;
       }
  
  
  
  1.3       +1 -12     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/TreeSetBasedObjectAccumulator.java
  
  Index: TreeSetBasedObjectAccumulator.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/TreeSetBasedObjectAccumulator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TreeSetBasedObjectAccumulator.java	12 Feb 2004 20:06:18 -0000	1.2
  +++ TreeSetBasedObjectAccumulator.java	21 Apr 2004 22:08:03 -0000	1.3
  @@ -23,22 +23,11 @@
   public final class TreeSetBasedObjectAccumulator
       extends ObjectAccumulator
   {
  -    public TreeSetBasedObjectAccumulator(Class component_type,
  -                                         int initial_capacity,
  -                                         boolean return_collection)
  -    {
  -        super(component_type, initial_capacity, return_collection);
  -    }
   
       public TreeSetBasedObjectAccumulator(Class component_type,
                                            int initial_capacity)
       {
  -        super(component_type, initial_capacity);
  -    }
  -
  -    public TreeSetBasedObjectAccumulator(Class component_type)
  -    {
  -        super(component_type);
  +        super(component_type, initial_capacity, true);
       }
   
       protected Collection createNewStore(int capacity)
  
  
  
  1.3       +1 -14     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/VectorBasedObjectAccumulator.java
  
  Index: VectorBasedObjectAccumulator.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/util/collections/VectorBasedObjectAccumulator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- VectorBasedObjectAccumulator.java	12 Feb 2004 20:06:18 -0000	1.2
  +++ VectorBasedObjectAccumulator.java	21 Apr 2004 22:08:03 -0000	1.3
  @@ -24,22 +24,9 @@
       extends ObjectAccumulator
   {
       public VectorBasedObjectAccumulator(Class component_type,
  -                                        int initial_capacity,
  -                                        boolean return_collection)
  -    {
  -        super(component_type, initial_capacity, return_collection);
  -    }
  -
  -
  -    public VectorBasedObjectAccumulator(Class component_type,
                                           int initial_capacity)
       {
  -        super(component_type, initial_capacity);
  -    }
  -
  -    public VectorBasedObjectAccumulator(Class component_type)
  -    {
  -        super(component_type);
  +        super(component_type, initial_capacity, true);
       }
   
       protected Collection createNewStore(int capacity)
  
  
  
  1.30      +35 -0     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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- example_config.xml	21 Apr 2004 05:29:41 -0000	1.29
  +++ example_config.xml	21 Apr 2004 22:08:03 -0000	1.30
  @@ -166,6 +166,8 @@
                   <bin:qname>java:BooleanArray</bin:qname>
                   <bin:multiple>true</bin:multiple>
               </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>
  @@ -178,6 +180,39 @@
                   </bin:setter>
                   <bin:collection>java.lang.String[]</bin:collection>
                   <bin:qname>java:StringArray</bin:qname>
  +                <bin:multiple>true</bin:multiple>
  +            </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>
  +                    <bin:method-name>getStrs</bin:method-name>
  +                </bin:getter>
  +                <bin:setter>
  +                    <bin:method-name>setStrs</bin:method-name>
  +                    <bin:param-type>java.util.List</bin:param-type>
  +                </bin:setter>
  +                <bin:collection>java.util.List</bin:collection>
  +                <bin:qname>java:strs</bin:qname>
  +                <bin:multiple>true</bin:multiple>
  +                <bin:nillable>true</bin:nillable>
  +            </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>
  +                    <bin:method-name>getBools</bin:method-name>
  +                </bin:getter>
  +                <bin:setter>
  +                    <bin:method-name>setBools</bin:method-name>
  +                    <bin:param-type>java.util.List</bin:param-type>
  +                </bin:setter>
  +                <bin:collection>java.util.List</bin:collection>
  +                <bin:qname>java:bools</bin:qname>
                   <bin:multiple>true</bin:multiple>
               </bin:qname-property>
   
  
  
  
  1.21      +41 -30    xml-xmlbeans/v2/test/cases/marshal/com/mytest/YourClass.java
  
  Index: YourClass.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/test/cases/marshal/com/mytest/YourClass.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- YourClass.java	21 Apr 2004 05:29:41 -0000	1.20
  +++ YourClass.java	21 Apr 2004 22:08:03 -0000	1.21
  @@ -36,8 +36,10 @@
       private float myFloat;
       private float attrib;
       private boolean someBool;
  -//    private List bools;// = newBoolList();
  -//    private List strs;// = newStringList();
  +
  +    private List bools = newBoolList();
  +    private List strs = newStringList();
  +
       private long[] longArray;// = {RND.nextLong(), RND.nextLong()};
   
       private boolean[] booleanArray;// = {true, false, true};
  @@ -69,24 +71,31 @@
   
       private Date someDate;
   
  +
       //hack alert
       static final Random RND = new Random();
   
       private List newStringList()
       {
           ArrayList l = new ArrayList();
  -        l.add("one:" + RND.nextInt());
  -        l.add("two:" + RND.nextInt());
  +        l.add("STRONE:" + RND.nextInt());
  +        l.add("STRTWO:" + RND.nextInt());
           l.add(null);
  -        l.add("three:" + RND.nextInt());
  +        l.add("STRTHREE:" + RND.nextInt());
           return l;
       }
   
       private List newBoolList()
       {
           ArrayList l = new ArrayList();
  -        l.add(Boolean.TRUE);
  -        l.add(Boolean.FALSE);
  +        l.add(Boolean.valueOf(RND.nextBoolean()));
  +        l.add(Boolean.valueOf(RND.nextBoolean()));
  +        l.add(Boolean.valueOf(RND.nextBoolean()));
  +        l.add(Boolean.valueOf(RND.nextBoolean()));
  +        l.add(Boolean.valueOf(RND.nextBoolean()));
  +        l.add(Boolean.valueOf(RND.nextBoolean()));
  +        l.add(Boolean.valueOf(RND.nextBoolean()));
  +        l.add(Boolean.valueOf(RND.nextBoolean()));
   //        l.add(null);
   //        l.add(Boolean.TRUE);
   //        l.add(Boolean.FALSE);
  @@ -151,16 +160,16 @@
       {
           this.someBool = someBool;
       }
  -//
  -//    public List getBools()
  -//    {
  -//        return bools;
  -//    }
  -//
  -//    public void setBools(List bools)
  -//    {
  -//        this.bools = bools;
  -//    }
  +
  +    public List getBools()
  +    {
  +        return bools;
  +    }
  +
  +    public void setBools(List bools)
  +    {
  +        this.bools = bools;
  +    }
   
   
       /**
  @@ -180,15 +189,15 @@
           this.attrib = attrib;
       }
   
  -//    public List getStrs()
  -//    {
  -//        return strs;
  -//    }
  -//
  -//    public void setStrs(List strs)
  -//    {
  -//        this.strs = strs;
  -//    }
  +    public List getStrs()
  +    {
  +        return strs;
  +    }
  +
  +    public void setStrs(List strs)
  +    {
  +        this.strs = strs;
  +    }
   
       public long[] getLongArray()
       {
  @@ -374,7 +383,10 @@
           if (myFloat != yourClass.myFloat) return false;
           if (someBool != yourClass.someBool) return false;
           if (!Arrays.equals(booleanArray, yourClass.booleanArray)) return false;
  -//        if (bools != null ? !bools.equals(yourClass.bools) : yourClass.bools != null)
return false;
  +
  +        if (strs != null ? !strs.equals(yourClass.strs) : yourClass.strs != null) return
false;
  +        if (bools != null ? !bools.equals(yourClass.bools) : yourClass.bools != null) return
false;
  +
           if (!Arrays.equals(longArray, yourClass.longArray)) return false;
           if (myClass != null ? !myClass.equals(yourClass.myClass) : yourClass.myClass !=
null) return false;
           if (!Arrays.equals(myClassArray, yourClass.myClassArray)) return false;
  @@ -382,7 +394,6 @@
           if (!Arrays.equals(simpleStringArray, yourClass.simpleStringArray)) return false;
           if (!Arrays.equals(simpleLongArray, yourClass.simpleLongArray)) return false;
           if (!Arrays.equals(wrappedArrayOne, yourClass.wrappedArrayOne)) return false;
  -//        if (strs != null ? !strs.equals(yourClass.strs) : yourClass.strs != null) return
false;
   
           if (qn != null ? !qn.equals(yourClass.qn) : yourClass.qn != null) return false;
           if (qn2 != null ? !qn2.equals(yourClass.qn2) : yourClass.qn2 != null) return false;
  @@ -425,8 +436,8 @@
               ", intEnum=" + intEnum +
               ", integerEnum=" + integerEnum +
               ", simpleContentExample=" + simpleContentExample +
  -//            ", bools=" + (bools == null ? null : "size:" + bools.size() + bools) +
  -//            ", strs=" + (strs == null ? null : "size:" + strs.size() + strs) +
  +            ", bools=" + (bools == null ? null : "size:" + bools.size() + bools) +
  +            ", strs=" + (strs == null ? null : "size:" + strs.size() + strs) +
               ", longArray=" + ArrayUtils.arrayToString(longArray) +
               ", booleanArray=" + ArrayUtils.arrayToString(booleanArray) +
               ", stringArray=" + ArrayUtils.arrayToString(stringArray) +
  
  
  

---------------------------------------------------------------------
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