XPathFunction () { if (myFunction != null && myFunction.first.equals(getQName().toString())) { return myFunction.second; } else { final XPathFunctionCallImpl call = XPathFunctionCallImpl.this; final ContextProvider contextProvider = call.getXPathContext(); final QName name = contextProvider.getQName(call); if (name == null) return null; final Function functionDecl = contextProvider.getFunctionContext().resolve(name, getArgumentList().length); final XPathFunction impl = functionDecl == null ? null : functionDecl instanceof XPathFunction ? (XPathFunction)functionDecl : new FunctionImpl(functionDecl); return (myFunction = Pair.create(getQName().toString(), impl)).second; } }