public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(functionName); buffer.append('('); Expression[] args = getArguments(); if (args != null) { for (int i = 0; i < args.length; i++) { if (i > 0) { buffer.append(", "); } buffer.append(args[i]); } } buffer.append(')'); return buffer.toString(); }
public Object function(Object name, Object[] args) { return new ExtensionFunction((QName) name, toExpressionArray(args)); }
public Object compute(EvalContext context) { return computeValue(context); }
String name = extensionFunction.getFunctionName().toString(); Expression[] arguments = extensionFunction.getArguments(); extensionFunction.toString())); mLogger.log(Level.FINEST, "processExtensionFunction", xpe); throw xpe; XPathException xpe = new XPathException( mMsgMgr.getString("Invalid_XPath_Function", extensionFunction.toString())); mLogger.log(Level.FINEST, "processExtensionFunction", xpe); throw xpe;
public Object computeValue(EvalContext context) { Object[] parameters = null; if (args != null) { parameters = new Object[args.length]; for (int i = 0; i < args.length; i++) { parameters[i] = convert(args[i].compute(context)); } } Function function = context.getRootContext().getFunction(functionName, parameters); if (function == null) { throw new JXPathFunctionNotFoundException("No such function: " + functionName + Arrays.asList(parameters)); } Object result = function.invoke(context, parameters); return result instanceof NodeSet ? new NodeSetContext(context, (NodeSet) result) : result; }