org.apache.xalan.extensions
Class MethodResolver
public class MethodResolver
Utility class to help resolve method overloading with Xalan XSLT
argument types.
static int | DYNAMIC - Specifies a Dynamic method search.
|
static int | INSTANCE_ONLY - Specifies a search for instance methods only.
|
static int | STATIC_AND_INSTANCE - Specifies a search for both static and instance methods.
|
static int | STATIC_ONLY - Specifies a search for static methods only.
|
static void | convertParams(Object[] argsIn, Object[][] argsOut, Class[] paramTypes, ExpressionContext exprContext) - Convert a set of parameters based on a set of paramTypes.
|
static Constructor | getConstructor(Class classObj, Object[] argsIn, Object[][] argsOut, ExpressionContext exprContext) - Given a class, figure out the resolution of
the Java Constructor from the XSLT argument types, and perform the
conversion of the arguments.
|
static Method | getElementMethod(Class classObj, String name) - Given the name of a method, figure out the resolution of
the Java Method
|
static Method | getMethod(Class classObj, String name, Object[] argsIn, Object[][] argsOut, ExpressionContext exprContext, int searchMethod) - Given the name of a method, figure out the resolution of
the Java Method from the XSLT argument types, and perform the
conversion of the arguments.
|
static int | scoreMatch(Class[] javaParamTypes, int javaParamsStart, Object[] xsltArgs, int score) - Score the conversion of a set of XSLT arguments to a
given set of Java parameters.
|
DYNAMIC
public static final int DYNAMIC
Specifies a Dynamic method search. If the method being
evaluated is a static method, all arguments are used.
Otherwise, it is an instance method and only arguments
beginning with the second argument are used.
INSTANCE_ONLY
public static final int INSTANCE_ONLY
Specifies a search for instance methods only.
STATIC_AND_INSTANCE
public static final int STATIC_AND_INSTANCE
Specifies a search for both static and instance methods.
STATIC_ONLY
public static final int STATIC_ONLY
Specifies a search for static methods only.
convertParams
public static void convertParams(Object[] argsIn,
Object[][] argsOut,
Class[] paramTypes,
ExpressionContext exprContext)
throws TransformerException
Convert a set of parameters based on a set of paramTypes.
argsIn
- An array of XSLT/XPath arguments.argsOut
- An array of the exact size as argsIn, which will be
populated with converted arguments.paramTypes
- An array of class objects, of the exact same
size as argsIn and argsOut.
getConstructor
public static Constructor getConstructor(Class classObj,
Object[] argsIn,
Object[][] argsOut,
ExpressionContext exprContext)
throws NoSuchMethodException,
SecurityException,
TransformerException
Given a class, figure out the resolution of
the Java Constructor from the XSLT argument types, and perform the
conversion of the arguments.
classObj
- the Class of the object to be constructed.argsIn
- An array of XSLT/XPath arguments.argsOut
- An array of the exact size as argsIn, which will be
populated with converted arguments if a suitable method is found.
- A constructor that will work with the argsOut array.
getElementMethod
public static Method getElementMethod(Class classObj,
String name)
throws NoSuchMethodException,
SecurityException,
TransformerException
Given the name of a method, figure out the resolution of
the Java Method
classObj
- The Class of the object that should have the method.name
- The name of the method to be invoked.
- A method that will work to be called as an element.
getMethod
public static Method getMethod(Class classObj,
String name,
Object[] argsIn,
Object[][] argsOut,
ExpressionContext exprContext,
int searchMethod)
throws NoSuchMethodException,
SecurityException,
TransformerException
Given the name of a method, figure out the resolution of
the Java Method from the XSLT argument types, and perform the
conversion of the arguments.
classObj
- The Class of the object that should have the method.name
- The name of the method to be invoked.argsIn
- An array of XSLT/XPath arguments.argsOut
- An array of the exact size as argsIn, which will be
populated with converted arguments if a suitable method is found.
- A method that will work with the argsOut array.
scoreMatch
public static int scoreMatch(Class[] javaParamTypes,
int javaParamsStart,
Object[] xsltArgs,
int score)
Score the conversion of a set of XSLT arguments to a
given set of Java parameters.
If any invocations of this function for a method with
the same name return the same positive value, then a conflict
has occured, and an error should be signaled.
javaParamTypes
- Must be filled with valid class names, and
of the same length as xsltArgs.xsltArgs
- Must be filled with valid object instances, and
of the same length as javeParamTypes.
- -1 for no allowed conversion, or a positive score
that is closer to zero for more preferred, or further from
zero for less preferred.
Copyright B) 2004 Apache XML Project. All Rights Reserved.