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

## com.novell.xml.xpath
Class Function

    java.lang.Object
      com.novell.xml.xpath.Function

Direct Known Subclasses:
  BadFunction, ECMAScriptFunction, JavaInstance, JavaMember, xpathBoolean, xpathCeiling, xpathConcat, xpathContains, xpathCount, xpathFalse, xpathFloor, xpathId, xpathLang, xpathLast, xpathLocalName, xpathName, xpathNamespaceUri, xpathNormalizeSpace, xpathNot, xpathNumber, xpathPosition, xpathRound, xpathStartsWith, xpathString, xpathStringLength, xpathSubstring, xpathSubstringAfter, xpathSubstringBefore, xpathSum, xpathTranslate, xpathTrue, xsltCurrent, xsltDocument, xsltElementAvailable, xsltFormatNumber, xsltFunctionAvailable, xsltGenerateId, xsltKey, xsltSystemProperty, xsltUnparsedEntityURI

    public abstract class Function

extends Object

This class provides the basic common implementation for XPath functions. Functions in XPath must be derived from this class. The basic method of implementing a function is to derive a class from this class and provide one or more public methods for the implementation of the function. If the default invoke() member is not overridden the must be a separate, public member for each combination of arguments (required and optional). The default invoke member() uses introspection to find the methods in derived classes that match the function signature. This method information is cached, and is not calculated until the first invocation. However, better performance can probably be gained by over- riding invoke(). For functions that take different types of arguments, invoke() must be overridden (e.g., XPath's string(), boolean(), number(), and id() functions, which are defined to take any of the four basic types).

See Also:
  `FunctionSignature`, `FunctionCall`

Constructor Summary
`protected` | `Function(FunctionSignature signature)` Construct a Function with the passed signature

Method Summary
`Function` | `getInstance(ArgumentList args)` Return an instance of this function that matches the passed argument list.
`protected FunctionSignature` | `getSignature()` Return the signature for this Function.
`ExpressionValue` | `invoke(Object[] args)` Invoke the function using the passed list of arguments.
`boolean` | `isConstant()` Return true if the expression is a constant value.
`void` | `registerForReset(XPathResetRegistrar registrar)` Register this expression or any subexpression that implements XPathResetCache with an object that wants to call `resetCache()`

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

Constructor Detail

### Function

    protected Function(FunctionSignature signature)

  Construct a Function with the passed signature

  Parameters:
    `signature` - Object describing return type, name, and arguments

Method Detail

### getInstance

    public Function getInstance(ArgumentList args)
                         throws XPathParserException

  Return an instance of this function that matches the passed argument list. This is intended primarily to be overridden in support of extension functions

  Parameters:
    `args` - The argument list
  Throws:
    `XPathParserException`

### invoke

    public ExpressionValue invoke(Object[] args)
                           throws XPathEvaluationException

  Invoke the function using the passed list of arguments. This member uses introspection to perform the invocation; better performance can be obtained by overriding this member in derived classes. This member MUST be overridden for those function implementations that accept differing argument types.

  Parameters:
    `args` - List of arguments.
  Returns:
    An object containing the result of the function invocation.
  Throws:
    `XPathEvaluationException`

### isConstant

    public boolean isConstant()

  Return true if the expression is a constant value. Default return is false. Derived functions may want to override this (true(), false(), for example)

  Returns:
    True is expression is constant, false otherwise.

### registerForReset

    public void registerForReset(XPathResetRegistrar registrar)

  Register this expression or any subexpression that implements XPathResetCache with an object that wants to call `resetCache()`

### getSignature

    protected FunctionSignature getSignature()

  Return the signature for this Function.

  Returns:
    The object describing the function signature.

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