1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements.  See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License.  You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 // $Id: XPathFunctionResolver.java 446598 2006-09-15 12:55:40Z jeremias $
18 
19 package javax.xml.xpath;
20 
21 import javax.xml.namespace.QName;
22 
23 /**
24  * <p><code>XPathFunctionResolver</code> provides access to the set of user defined <code>XPathFunction</code>s.</p>
25  *
26  * <p>XPath functions are resolved by name and arity.
27  * The resolver is not needed for XPath built-in functions and the resolver
28  * <strong><em>cannot</em></strong> be used to override those functions.</p>
29  *
30  * <p>In particular, the resolver is only called for functions in an another
31  * namespace (functions with an explicit prefix). This means that you cannot
32  * use the <code>XPathFunctionResolver</code> to implement specifications
33  * like <a href="http://www.w3.org/TR/xmldsig-core/">XML-Signature Syntax
34  * and Processing</a> which extend the function library of XPath 1.0 in the
35  * same namespace. This is a consequence of the design of the resolver.</p>
36  *
37  * <p>If you wish to implement additional built-in functions, you will have to
38  * extend the underlying implementation directly.</p>
39  *
40  * @author  <a href="mailto:Norman.Walsh@Sun.com">Norman Walsh</a>
41  * @author  <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a>
42  * @version $Revision: 446598 $, $Date: 2006-09-15 05:55:40 -0700 (Fri, 15 Sep 2006) $
43  * @see <a href="http://www.w3.org/TR/xpath#corelib">XML Path Language (XPath) Version 1.0, Core Function Library</a>
44  * @since 1.5
45  */
46 public interface XPathFunctionResolver {
47   /**
48    * <p>Find a function in the set of available functions.</p>
49    *
50    * <p>If <code>functionName</code> or <code>arity</code> is <code>null</code>, then a <code>NullPointerException</code> is thrown.</p>
51    *
52    * @param functionName The function name.
53    * @param arity The number of arguments that the returned function must accept.
54    *
55    * @return The function or <code>null</code> if no function named <code>functionName</code> with <code>arity</code> arguments exists.
56    *
57    * @throws NullPointerException If <code>functionName</code> or <code>arity</code> is <code>null</code>.
58    */
resolveFunction(QName functionName, int arity)59   public XPathFunction resolveFunction(QName functionName, int arity);
60 }
61