axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/encoding ArraySerializer.java SOAPTypeMappingRegistry.java
Date Sun, 08 Jul 2001 11:59:50 GMT
rubys       01/07/08 04:59:50

  Modified:    java/samples/echo EchoService.java
               java/src/org/apache/axis/encoding ArraySerializer.java
                        SOAPTypeMappingRegistry.java
  Log:
  Make array deserializers use primitive types when available; add Byte
  
  Revision  Changes    Path
  1.4       +2 -2      xml-axis/java/samples/echo/EchoService.java
  
  Index: EchoService.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/echo/EchoService.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- EchoService.java	2001/07/08 00:02:11	1.3
  +++ EchoService.java	2001/07/08 11:59:48	1.4
  @@ -93,7 +93,7 @@
        * This method accepts an array of integers and echoes it back to the 
        * client.
        */
  -    public Integer[] echoIntegerArray(Integer[] input) {
  +    public int[] echoIntegerArray(int[] input) {
           return input;
       }
   
  @@ -107,7 +107,7 @@
       /**
        * This method accepts an array of floats and echoes it back to the client.
        */
  -    public Float[] echoFloatArray(Float[] input) {
  +    public float[] echoFloatArray(float[] input) {
           return input;
       }
   
  
  
  
  1.7       +17 -0     xml-axis/java/src/org/apache/axis/encoding/ArraySerializer.java
  
  Index: ArraySerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ArraySerializer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ArraySerializer.java	2001/07/01 03:30:48	1.6
  +++ ArraySerializer.java	2001/07/08 11:59:49	1.7
  @@ -63,6 +63,7 @@
   import java.lang.reflect.Array;
   import java.io.IOException;
   import java.util.List;
  +import java.util.Hashtable;
   
   /** An ArraySerializer handles serializing and deserializing SOAP
    * arrays.
  @@ -75,6 +76,18 @@
   public class ArraySerializer extends DeserializerBase
       implements ValueReceiver, Serializer
   {
  +
  +    static Hashtable primitives = new Hashtable();
  +    static {
  +      primitives.put(Character.class, Character.TYPE);
  +      primitives.put(Byte.class, Byte.TYPE);
  +      primitives.put(Short.class, Short.TYPE);
  +      primitives.put(Integer.class, Integer.TYPE);
  +      primitives.put(Long.class, Long.TYPE);
  +      primitives.put(Float.class, Float.TYPE);
  +      primitives.put(Double.class, Double.TYPE);
  +    }
  +
       public static class Factory implements DeserializerFactory {
           public DeserializerBase getDeserializer() {
               return new ArraySerializer();
  @@ -145,6 +158,10 @@
                   if (componentType == null)
                       throw new SAXException("No component type for " + arrayItemType);
                   
  +                // Replace wrapper classes with primitive equivalents
  +                Object primitive = primitives.get(componentType);
  +                if (primitive != null) componentType = (Class) primitive;
  +
                   value = Array.newInstance(componentType, length);
   
               }
  
  
  
  1.20      +11 -0     xml-axis/java/src/org/apache/axis/encoding/SOAPTypeMappingRegistry.java
  
  Index: SOAPTypeMappingRegistry.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/SOAPTypeMappingRegistry.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- SOAPTypeMappingRegistry.java	2001/07/08 00:50:34	1.19
  +++ SOAPTypeMappingRegistry.java	2001/07/08 11:59:49	1.20
  @@ -72,6 +72,7 @@
       public static final QName XSD_INT = new QName(Constants.URI_CURRENT_SCHEMA_XSD, "int");
       public static final QName XSD_LONG = new QName(Constants.URI_CURRENT_SCHEMA_XSD, "long");
       public static final QName XSD_SHORT = new QName(Constants.URI_CURRENT_SCHEMA_XSD, "short");
  +    public static final QName XSD_BYTE = new QName(Constants.URI_CURRENT_SCHEMA_XSD, "byte");
       public static final QName XSD_DECIMAL = new QName(Constants.URI_CURRENT_SCHEMA_XSD,
"decimal");
       public static final QName XSD_BASE64 = new QName(Constants.URI_CURRENT_SCHEMA_XSD,
"base64");
   
  @@ -82,6 +83,7 @@
       public static final QName SOAP_INT = new QName(Constants.URI_SOAP_ENC, "int");
       public static final QName SOAP_LONG = new QName(Constants.URI_SOAP_ENC, "long");
       public static final QName SOAP_SHORT = new QName(Constants.URI_SOAP_ENC, "short");
  +    public static final QName SOAP_BYTE = new QName(Constants.URI_SOAP_ENC, "byte");
       public static final QName SOAP_ARRAY = new QName(Constants.URI_SOAP_ENC, "Array");
   
       public static       QName XSD_DATE;
  @@ -147,6 +149,12 @@
       class ShortDeserializerFactory implements DeserializerFactory {
           public DeserializerBase getDeserializer() { return new ShortDeser(); }
       }
  +    class ByteDeser extends BasicDeser {
  +        Object makeValue(String source) { return new Byte(source); }
  +    }
  +    class ByteDeserializerFactory implements DeserializerFactory {
  +        public DeserializerBase getDeserializer() { return new ByteDeser(); }
  +    }
       class DecimalDeser extends BasicDeser {
           Object makeValue(String source) { return new BigDecimal(source); }
       }
  @@ -196,6 +204,7 @@
               if (_class == int.class)     qName = XSD_INT;
               if (_class == long.class)    qName = XSD_LONG;
               if (_class == short.class)   qName = XSD_SHORT;
  +            if (_class == byte.class)    qName = XSD_BYTE;
           }
           return qName;
       }
  @@ -209,6 +218,7 @@
           addSerializer(java.lang.Integer.class, XSD_INT, se);
           addSerializer(java.lang.Long.class, XSD_LONG, se);
           addSerializer(java.lang.Short.class, XSD_SHORT, se);
  +        addSerializer(java.lang.Byte.TYPE, XSD_BYTE, se);
           addSerializer(java.util.Date.class, XSD_DATE, new DateSerializer());
           addSerializer(byte[].class, XSD_BASE64, new Base64Serializer());
           addSerializer(java.math.BigDecimal.class, XSD_DECIMAL, se);
  @@ -220,6 +230,7 @@
           addDeserializersFor(XSD_INT, java.lang.Integer.class, new IntDeserializerFactory());
           addDeserializersFor(XSD_LONG, java.lang.Long.class, new LongDeserializerFactory());
           addDeserializersFor(XSD_SHORT, java.lang.Short.class, new ShortDeserializerFactory());
  +        addDeserializersFor(XSD_BYTE, java.lang.Byte.class, new ByteDeserializerFactory());
           addDeserializersFor(XSD_DECIMAL, java.math.BigDecimal.class, new DecimalDeserializerFactory());
           addDeserializersFor(XSD_BASE64, byte[].class, new Base64Serializer.Base64DeserializerFactory());
   
  
  
  

Mime
View raw message