axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/utils JavaUtils.java
Date Wed, 19 Dec 2001 15:05:31 GMT
scheu       01/12/19 07:05:31

  Modified:    java/src/org/apache/axis/encoding ArraySerializer.java
               java/src/org/apache/axis/utils JavaUtils.java
  Log:
  Some cleanup.  JavaUtils.convert recognizes new ConvertCache interface to retrieve previously
converted objects
  
  Revision  Changes    Path
  1.29      +1 -1      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.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- ArraySerializer.java	2001/12/18 21:28:21	1.28
  +++ ArraySerializer.java	2001/12/19 15:05:30	1.29
  @@ -121,7 +121,7 @@
        * converted array values.  This class is essential to support
        * arrays that are multi-referenced.
        **/
  -    public class ArrayListExtension extends ArrayList {
  +    public class ArrayListExtension extends ArrayList implements JavaUtils.ConvertCache
{
           private Hashtable table = null;
           
           /**
  
  
  
  1.17      +18 -5     xml-axis/java/src/org/apache/axis/utils/JavaUtils.java
  
  Index: JavaUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/JavaUtils.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- JavaUtils.java	2001/12/18 21:28:21	1.16
  +++ JavaUtils.java	2001/12/19 15:05:31	1.17
  @@ -56,7 +56,6 @@
   package org.apache.axis.utils;
   
   import org.apache.log4j.Category;
  -import org.apache.axis.encoding.ArraySerializer;
   
   import java.lang.reflect.Array;
   
  @@ -79,6 +78,20 @@
       static Category category =
               Category.getInstance(JavaUtils.class.getName());
   
  +    /**
  +     * It the argument to the convert(...) method implements
  +     * the ConvertCache interface, the convert(...) method 
  +     * will use the set/get methods to store and retrieve
  +     * converted values.  
  +     **/
  +    public interface ConvertCache {
  +        /**
  +         * Set/Get converted values of the convert method.
  +         **/
  +        public void setConvertedValue(Class cls, Object value);
  +        public Object getConvertedValue(Class cls);
  +    }
  +
       /** Utility function to convert an Object to some desired Class.
        * 
        * Right now this only works for arrays <-> Lists, but it might be
  @@ -99,8 +112,8 @@
   
           // See if a previously converted value is stored in the argument.
           Object destValue = null;
  -        if (arg instanceof ArraySerializer.ArrayListExtension) {
  -            destValue = (( ArraySerializer.ArrayListExtension) arg).getConvertedValue(destClass);
  +        if (arg instanceof ConvertCache) {
  +            destValue = (( ConvertCache) arg).getConvertedValue(destClass);
               if (destValue != null)
                   return destValue;
           }
  @@ -153,8 +166,8 @@
           }
   
           // Store the converted value in the argument if possible.
  -        if (arg instanceof ArraySerializer.ArrayListExtension) {
  -            (( ArraySerializer.ArrayListExtension) arg).setConvertedValue(destClass, destValue);
  +        if (arg instanceof ConvertCache) {
  +            (( ConvertCache) arg).setConvertedValue(destClass, destValue);
           }
           return destValue;
       }
  
  
  

Mime
View raw message