14c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson/* 24c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * Licensed to the Apache Software Foundation (ASF) under one or more 34c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * contributor license agreements. See the NOTICE file distributed with 44c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * this work for additional information regarding copyright ownership. 54c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * The ASF licenses this file to You under the Apache License, Version 2.0 64c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * (the "License"); you may not use this file except in compliance with 74c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * the License. You may obtain a copy of the License at 84c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * 94c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * http://www.apache.org/licenses/LICENSE-2.0 104c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * 114c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * Unless required by applicable law or agreed to in writing, software 124c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * distributed under the License is distributed on an "AS IS" BASIS, 134c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 144c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * See the License for the specific language governing permissions and 154c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * limitations under the License. 164c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson */ 174c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson// $Id: XPathFunctionResolver.java 446598 2006-09-15 12:55:40Z jeremias $ 184c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson 194c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilsonpackage javax.xml.xpath; 204c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson 214c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilsonimport javax.xml.namespace.QName; 224c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson 234c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson/** 244c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * <p><code>XPathFunctionResolver</code> provides access to the set of user defined <code>XPathFunction</code>s.</p> 254c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * 264c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * <p>XPath functions are resolved by name and arity. 274c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * The resolver is not needed for XPath built-in functions and the resolver 284c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * <strong><em>cannot</em></strong> be used to override those functions.</p> 294c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * 304c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * <p>In particular, the resolver is only called for functions in an another 314c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * namespace (functions with an explicit prefix). This means that you cannot 324c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * use the <code>XPathFunctionResolver</code> to implement specifications 334c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * like <a href="http://www.w3.org/TR/xmldsig-core/">XML-Signature Syntax 344c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * and Processing</a> which extend the function library of XPath 1.0 in the 354c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * same namespace. This is a consequence of the design of the resolver.</p> 364c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * 374c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * <p>If you wish to implement additional built-in functions, you will have to 384c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * extend the underlying implementation directly.</p> 394c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * 404c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * @author <a href="mailto:Norman.Walsh@Sun.com">Norman Walsh</a> 414c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a> 424c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * @version $Revision: 446598 $, $Date: 2006-09-15 05:55:40 -0700 (Fri, 15 Sep 2006) $ 434c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * @see <a href="http://www.w3.org/TR/xpath#corelib">XML Path Language (XPath) Version 1.0, Core Function Library</a> 444c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * @since 1.5 454c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson */ 464c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilsonpublic interface XPathFunctionResolver { 474c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson /** 484c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * <p>Find a function in the set of available functions.</p> 494c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * 504c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * <p>If <code>functionName</code> or <code>arity</code> is <code>null</code>, then a <code>NullPointerException</code> is thrown.</p> 514c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * 524c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * @param functionName The function name. 534c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * @param arity The number of arguments that the returned function must accept. 544c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * 554c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * @return The function or <code>null</code> if no function named <code>functionName</code> with <code>arity</code> arguments exists. 564c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * 574c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson * @throws NullPointerException If <code>functionName</code> or <code>arity</code> is <code>null</code>. 584c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson */ 594c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson public XPathFunction resolveFunction(QName functionName, int arity); 604c7a0d97cf2b27790e6236965a1d798d710d7ec7Jesse Wilson} 61