Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.jxpath
Class ClassFunctions

    java.lang.Object
      |
      +--org.apache.commons.jxpath.ClassFunctions

All Implemented Interfaces:
  Functions

public class ClassFunctions
extends java.lang.Object
implements Functions

Extension functions provided by a Java class. Let's say, we declared a ClassFunction like this:

>          new ClassFunctions(Integer.class, "int")

We can now use XPaths like:

`"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: 1.7 $ $Date: 2003/03/11 00:59:11 $
Author:
  Dmitri Plotnikov

Constructor Summary
`ClassFunctions(java.lang.Class functionClass, java.lang.String namespace)`

Method Summary
`Function` | `getFunction(java.lang.String namespace, java.lang.String name, java.lang.Object[] parameters)` Returns a Function, if any, for the specified namespace, name and parameter types.
`java.util.Set` | `getUsedNamespaces()` Returns a set of one namespace - the one specified in the constructor.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ClassFunctions

    public ClassFunctions(java.lang.Class functionClass,
                          java.lang.String namespace)

Method Detail

### getUsedNamespaces

    public java.util.Set getUsedNamespaces()

  Returns a set of one namespace - the one specified in the constructor.
  Specified by:
    `getUsedNamespaces` in interface `Functions`

### getFunction

    public Function getFunction(java.lang.String namespace,
                                java.lang.String name,
                                java.lang.Object[] parameters)

  Returns a Function, if any, for the specified namespace, name and parameter types.
  Specified by:
    `getFunction` in interface `Functions`
  Parameters:
    `namespace` - if it is not the namespace specified in the constructor, the method returns null
    `name` - is a function name or "new" for a constructor.
  Returns:
    a MethodFunction, a ConstructorFunction or null if there is no such function.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2003 Apache Software Foundation. All Rights Reserved.