You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by zi...@apache.org on 2004/04/28 02:01:38 UTC

cvs commit: xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal ListArrayRuntimeBindingType.java MarshalResult.java MarshallerImpl.java NamedXmlTypeVisitor.java RuntimeBindingProperty.java RuntimeBindingType.java RuntimeGlobalProperty.java SoapMarshallerImpl.java WrappedArrayRuntimeBindingType.java

zieg        2004/04/27 17:01:38

  Modified:    v2/src/marshal/org/apache/xmlbeans/impl/marshal
                        ListArrayRuntimeBindingType.java MarshalResult.java
                        MarshallerImpl.java NamedXmlTypeVisitor.java
                        RuntimeBindingProperty.java RuntimeBindingType.java
                        RuntimeGlobalProperty.java SoapMarshallerImpl.java
                        WrappedArrayRuntimeBindingType.java
  Log:
  cleanup marshalling of simple types
  
  Revision  Changes    Path
  1.6       +0 -11     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ListArrayRuntimeBindingType.java
  
  Index: ListArrayRuntimeBindingType.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/ListArrayRuntimeBindingType.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ListArrayRuntimeBindingType.java	27 Apr 2004 21:37:26 -0000	1.5
  +++ ListArrayRuntimeBindingType.java	28 Apr 2004 00:01:38 -0000	1.6
  @@ -113,17 +113,6 @@
               acc.append(prop_obj);
           }
   
  -        //non simple type props can throw some runtime exception.
  -        CharSequence getLexical(Object value, MarshalResult result)
  -            throws XmlException
  -        {
  -            assert value != null;
  -            assert  result != null;
  -            assert itemType.getMarshaller() != null;
  -
  -            return itemType.getMarshaller().print(value, result);
  -        }
  -
           Object getValue(Object parentObject, MarshalResult result)
               throws XmlException
           {
  
  
  
  1.29      +8 -6      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/MarshalResult.java
  
  Index: MarshalResult.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/MarshalResult.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- MarshalResult.java	27 Apr 2004 02:36:14 -0000	1.28
  +++ MarshalResult.java	28 Apr 2004 00:01:38 -0000	1.29
  @@ -215,17 +215,19 @@
       {
           if (instance == null ||
               expected.isJavaPrimitive() ||
  -            expected.isJavaFinal() ||
  -            instance.getClass().equals(expected.getJavaType())) {
  +            expected.isJavaFinal()) {
  +            return expected;
  +        }
  +
  +        final Class instance_class = instance.getClass();
  +        if (instance_class.equals(expected.getJavaType())) {
               return expected;
           }
   
           final BindingTypeName type_name = expected.getBindingType().getName();
  -        String expectedJavaClass = type_name.getJavaName().toString();
  -        String actualJavaClass = instance.getClass().getName();
  -        if (!actualJavaClass.equals(expectedJavaClass)) {
  +        if (!instance_class.getName().equals(type_name.getJavaName().toString())) {
               final BindingType actual_type =
  -                MarshallerImpl.lookupBindingType(instance.getClass(),
  +                MarshallerImpl.lookupBindingType(instance_class,
                                                    type_name.getJavaName(),
                                                    type_name.getXmlName(),
                                                    bindingLoader);
  
  
  
  1.28      +1 -1      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/MarshallerImpl.java
  
  Index: MarshallerImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/MarshallerImpl.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- MarshallerImpl.java	27 Apr 2004 02:36:14 -0000	1.27
  +++ MarshallerImpl.java	28 Apr 2004 00:01:38 -0000	1.28
  @@ -377,7 +377,7 @@
                                      nscontext, obj);
       }
   
  -    private static NamespaceContext getNamespaceContextFromOptions(XmlOptions options)
  +    static NamespaceContext getNamespaceContextFromOptions(XmlOptions options)
       {
           //TODO: do this properly
           return EmptyNamespaceContext.getInstance();
  
  
  
  1.11      +0 -1      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/NamedXmlTypeVisitor.java
  
  Index: NamedXmlTypeVisitor.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/NamedXmlTypeVisitor.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- NamedXmlTypeVisitor.java	12 Apr 2004 22:39:46 -0000	1.10
  +++ NamedXmlTypeVisitor.java	28 Apr 2004 00:01:38 -0000	1.11
  @@ -42,7 +42,6 @@
           actualRuntimeBindingType =
               property.getActualRuntimeType(parentObject, result);
   
  -        //TODO: optimize to avoid object creation
           final String uri = getBindingProperty().getName().getNamespaceURI();
           if (uri.length() > 0) {
               prefix = marshalResult.ensurePrefix(uri);
  
  
  
  1.21      +18 -2     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeBindingProperty.java
  
  Index: RuntimeBindingProperty.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeBindingProperty.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- RuntimeBindingProperty.java	27 Apr 2004 21:37:26 -0000	1.20
  +++ RuntimeBindingProperty.java	28 Apr 2004 00:01:38 -0000	1.21
  @@ -88,8 +88,24 @@
       abstract QName getName();
   
       //non simple type props can throw an exception
  -    abstract CharSequence getLexical(Object value, MarshalResult result)
  -        throws XmlException;
  +    final CharSequence getLexical(Object value,
  +                                  MarshalResult result)
  +        throws XmlException
  +    {
  +        assert value != null :
  +            "null value for " + getName();
  +
  +        assert  result != null;
  +
  +        final RuntimeBindingType actualRuntimeType =
  +            getActualRuntimeType(value, result);
  +
  +        assert actualRuntimeType.getMarshaller() != null :
  +            "null marshaller for prop=" + getName() +
  +            " propType=" + actualRuntimeType;
  +
  +        return actualRuntimeType.getMarshaller().print(value, result);
  +    }
   
       abstract Object getValue(Object parentObject, MarshalResult result)
           throws XmlException;
  
  
  
  1.19      +0 -17     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeBindingType.java
  
  Index: RuntimeBindingType.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeBindingType.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- RuntimeBindingType.java	27 Apr 2004 21:37:26 -0000	1.18
  +++ RuntimeBindingType.java	28 Apr 2004 00:01:38 -0000	1.19
  @@ -360,23 +360,6 @@
               return (val != null);
           }
   
  -        final CharSequence getLexical(Object value,
  -                                      MarshalResult result)
  -            throws XmlException
  -        {
  -            assert value != null :
  -                "null value for " + getName() + " class=" + beanClass;
  -
  -            assert  result != null :
  -                "null value for " + getName() + " class=" + beanClass;
  -
  -            assert runtimeBindingType.getMarshaller() != null :
  -                "null marshaller for prop=" + getName() + " java-type=" +
  -                beanClass + " propType=" + runtimeBindingType;
  -
  -            return runtimeBindingType.getMarshaller().print(value, result);
  -        }
  -
       }
   
   
  
  
  
  1.19      +0 -15     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeGlobalProperty.java
  
  Index: RuntimeGlobalProperty.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/RuntimeGlobalProperty.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- RuntimeGlobalProperty.java	27 Apr 2004 21:37:26 -0000	1.18
  +++ RuntimeGlobalProperty.java	28 Apr 2004 00:01:38 -0000	1.19
  @@ -66,21 +66,6 @@
           throw new UnsupportedOperationException();
       }
   
  -    //non simple type props can throw some runtime exception.
  -    public CharSequence getLexical(Object parent, MarshalResult result)
  -        throws XmlException
  -    {
  -        //TODO: polymorphism checks
  -        final TypeMarshaller tm = getRuntimeBindingType().getMarshaller();
  -
  -        if (tm == null) {
  -            throw new XmlException("Unable find marshaller for " + getType());
  -        }
  -
  -        final CharSequence retval = tm.print(parent, result);
  -        return retval;
  -    }
  -
       public Object getValue(Object parent_obj, MarshalResult result)
           throws XmlException
       {
  
  
  
  1.4       +9 -2      xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/SoapMarshallerImpl.java
  
  Index: SoapMarshallerImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/SoapMarshallerImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SoapMarshallerImpl.java	27 Apr 2004 02:36:14 -0000	1.3
  +++ SoapMarshallerImpl.java	28 Apr 2004 00:01:38 -0000	1.4
  @@ -21,10 +21,12 @@
   import org.apache.xmlbeans.XmlOptions;
   import org.apache.xmlbeans.impl.binding.bts.BindingLoader;
   
  +import javax.xml.namespace.NamespaceContext;
   import javax.xml.namespace.QName;
   import javax.xml.stream.XMLStreamReader;
   
  -class SoapMarshallerImpl implements SoapMarshaller
  +class SoapMarshallerImpl
  +    implements SoapMarshaller
   {
       //per binding context constants
       private final BindingLoader loader;
  @@ -48,7 +50,12 @@
                                          XmlOptions options)
           throws XmlException
       {
  -        throw new AssertionError("UNIMP: this=" + this);
  +        NamespaceContext nscontext =
  +            MarshallerImpl.getNamespaceContextFromOptions(options);
  +
  +        throw new AssertionError("UNIMP");
  +
  +
       }
   
       public XMLStreamReader marshalReferenced(XmlOptions options)
  
  
  
  1.8       +0 -11     xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/WrappedArrayRuntimeBindingType.java
  
  Index: WrappedArrayRuntimeBindingType.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/WrappedArrayRuntimeBindingType.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- WrappedArrayRuntimeBindingType.java	27 Apr 2004 21:37:26 -0000	1.7
  +++ WrappedArrayRuntimeBindingType.java	28 Apr 2004 00:01:38 -0000	1.8
  @@ -134,17 +134,6 @@
               acc.append(prop_obj);
           }
   
  -        //non simple type props can throw some runtime exception.
  -        CharSequence getLexical(Object value, MarshalResult result)
  -            throws XmlException
  -        {
  -            assert value != null;
  -            assert  result != null;
  -            assert itemType.getMarshaller() != null;
  -
  -            return itemType.getMarshaller().print(value, result);
  -        }
  -
           Object getValue(Object parentObject, MarshalResult result)
               throws XmlException
           {
  
  
  

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