axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject cvs commit: ws-axis/java/src/org/apache/axis/encoding TypeMappingImpl.java
Date Fri, 02 Jul 2004 13:00:31 GMT
ias         2004/07/02 06:00:31

  Modified:    java/src/org/apache/axis/encoding TypeMappingImpl.java
  Log:
  Improve getSerializer by looking into hierarchy of component type of Java array.
  
  Revision  Changes    Path
  1.50      +26 -0     ws-axis/java/src/org/apache/axis/encoding/TypeMappingImpl.java
  
  Index: TypeMappingImpl.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/TypeMappingImpl.java,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- TypeMappingImpl.java	25 Feb 2004 14:02:36 -0000	1.49
  +++ TypeMappingImpl.java	2 Jul 2004 13:00:31 -0000	1.50
  @@ -29,6 +29,8 @@
   
   import javax.xml.namespace.QName;
   import javax.xml.rpc.JAXRPCException;
  +
  +import java.lang.reflect.Array;
   import java.util.ArrayList;
   import java.util.HashMap;
   import java.util.List;
  @@ -300,6 +302,30 @@
   
           // Now get the serializer with the pair
           sf = (javax.xml.rpc.encoding.SerializerFactory) pair2SF.get(pair);
  +
  +        // Need to look into hierarchy of component type.
  +        // ex) java.util.GregorianCalendar[]
  +        //     -> java.util.Calendar[]
  +        if (sf == null && javaType.isArray()) {
  +            int dimension = 1;
  +            Class componentType = javaType.getComponentType();
  +            while (componentType.isArray()) {
  +                dimension += 1;
  +                componentType = componentType.getComponentType();
  +            }
  +            int[] dimensions = new int[dimension];
  +            componentType = componentType.getSuperclass();
  +            Class superJavaType = null;
  +            while (componentType != null) {
  +    			superJavaType = Array.newInstance(componentType, dimensions).getClass();
  +                pair = new Pair(superJavaType, xmlType);
  +                sf = (javax.xml.rpc.encoding.SerializerFactory) pair2SF.get(pair);
  +                if (sf != null) {
  +                    break;
  +                }
  +                componentType = componentType.getSuperclass();
  +            }
  +        }
   
           if (sf == null && delegate != null) {
               sf = delegate.getSerializer(javaType, xmlType);
  
  
  

Mime
View raw message