org.apache.velocity.util.introspection
Class IntrospectionUtils

java.lang.Object
  extended by org.apache.velocity.util.introspection.IntrospectionUtils

public class IntrospectionUtils
extends Object

Since:
1.6
Version:
$Id: IntrospectionUtils.java 476785 2006-11-19 10:06:21Z henning $
Author:
Jason van Zyl, Bob McWhirter, Christoph Reck, Geir Magnusson Jr., Attila Szegedi, Nathan Bubna

Constructor Summary
IntrospectionUtils()
           
 
Method Summary
static boolean isMethodInvocationConvertible(Class formal, Class actual, boolean possibleVarArg)
          Determines whether a type represented by a class object is convertible to another type represented by a class object using a method invocation conversion, treating object types of primitive types as if they were primitive types (that is, a Boolean actual parameter type matches boolean primitive formal type).
static boolean isStrictMethodInvocationConvertible(Class formal, Class actual, boolean possibleVarArg)
          Determines whether a type represented by a class object is convertible to another type represented by a class object using a method invocation conversion, without matching object and primitive types.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntrospectionUtils

public IntrospectionUtils()
Method Detail

isMethodInvocationConvertible

public static boolean isMethodInvocationConvertible(Class formal,
                                                    Class actual,
                                                    boolean possibleVarArg)
Determines whether a type represented by a class object is convertible to another type represented by a class object using a method invocation conversion, treating object types of primitive types as if they were primitive types (that is, a Boolean actual parameter type matches boolean primitive formal type). This behavior is because this method is used to determine applicable methods for an actual parameter list, and primitive types are represented by their object duals in reflective method calls.

Parameters:
formal - the formal parameter type to which the actual parameter type should be convertible
actual - the actual parameter type.
possibleVarArg - whether or not we're dealing with the last parameter in the method declaration
Returns:
true if either formal type is assignable from actual type, or formal is a primitive type and actual is its corresponding object type or an object type of a primitive type that can be converted to the formal type.

isStrictMethodInvocationConvertible

public static boolean isStrictMethodInvocationConvertible(Class formal,
                                                          Class actual,
                                                          boolean possibleVarArg)
Determines whether a type represented by a class object is convertible to another type represented by a class object using a method invocation conversion, without matching object and primitive types. This method is used to determine the more specific type when comparing signatures of methods.

Parameters:
formal - the formal parameter type to which the actual parameter type should be convertible
actual - the actual parameter type.
possibleVarArg - whether or not we're dealing with the last parameter in the method declaration
Returns:
true if either formal type is assignable from actual type, or formal and actual are both primitive types and actual can be subject to widening conversion to formal.


Copyright © 2000-2012 The Apache Software Foundation. All Rights Reserved.