jvanzyl     00/11/05 18:04:50

  Modified:    src/java/org/apache/velocity/util/introspection
                        ClassMap.java
  Log:
  - Map int native type to corresponding object type so that methods
    with integer arguments will be introspected correctly. This should
    probably be done for all the primitive number types.
  
  Revision  Changes    Path
  1.5       +17 -3     
jakarta-velocity/src/java/org/apache/velocity/util/introspection/ClassMap.java
  
  Index: ClassMap.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/util/introspection/ClassMap.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ClassMap.java     2000/11/03 14:37:49     1.4
  +++ ClassMap.java     2000/11/06 02:04:50     1.5
  @@ -65,7 +65,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Bob McWhirter</a>
  - * @version $Id: ClassMap.java,v 1.4 2000/11/03 14:37:49 jvanzyl Exp $
  + * @version $Id: ClassMap.java,v 1.5 2000/11/06 02:04:50 jvanzyl Exp $
    */
   
   public class ClassMap
  @@ -175,8 +175,22 @@
           StringBuffer methodKey = new StringBuffer().append(method.getName());
           
           for (int j = 0; j < parameterTypes.length; j++)
  -            methodKey.append(parameterTypes[j].getName());
  -        
  +        {
  +            /*
  +             * If the argument type is primitive then we want
  +             * to convert our primitive type signature to the 
  +             * corresponding Object type so introspection for
  +             * methods with primitive types will work correctly.
  +             */
  +            if (parameterTypes[j].isPrimitive())
  +            {
  +                if (parameterTypes[j].equals(Integer.TYPE))
  +                    methodKey.append("java.lang.Integer");
  +            }                
  +            else
  +                methodKey.append(parameterTypes[j].getName());
  +        }            
  +
           return methodKey.toString();
       }
   
  
  
  

Reply via email to