Package org.apache.commons.jxpath
Class ClassFunctions
- java.lang.Object
-
- org.apache.commons.jxpath.ClassFunctions
-
- All Implemented Interfaces:
Functions
public class ClassFunctions extends Object implements Functions
Extension functions provided by a Java class. Let's say we declared a ClassFunction like this:
We can now use XPaths like:new ClassFunctions(Integer.class, "int")"int:new(3)"- Equivalent to
new Integer(3) "int:getInteger('foo')"- Equivalent to
Integer.getInteger("foo") "int:floatValue(int:new(4))"- Equivalent to
new Integer(4).floatValue()
If the first argument of a method is
ExpressionContext, the expression context in which the function is evaluated is passed to the method.- Version:
- $Revision: 652845 $ $Date: 2008-05-02 12:46:46 -0500 (Fri, 02 May 2008) $
- Author:
- Dmitri Plotnikov
-
-
Constructor Summary
Constructors Constructor Description ClassFunctions(Class functionClass, String namespace)Create a new ClassFunctions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FunctiongetFunction(String namespace, String name, Object[] parameters)Returns aFunction, if any, for the specified namespace, name and parameter types.SetgetUsedNamespaces()Returns a set of one namespace - the one specified in the constructor.
-
-
-
Method Detail
-
getUsedNamespaces
public Set getUsedNamespaces()
Returns a set of one namespace - the one specified in the constructor.- Specified by:
getUsedNamespacesin interfaceFunctions- Returns:
- a singleton
-
getFunction
public Function getFunction(String namespace, String name, Object[] parameters)
Returns aFunction, if any, for the specified namespace, name and parameter types.- Specified by:
getFunctionin interfaceFunctions- Parameters:
namespace- if it is not the namespace specified in the constructor, the method returns nullname- is a function name or "new" for a constructor.parameters- Object[] of parameters- Returns:
- a MethodFunction, a ConstructorFunction or null if there is no such function.
-
-