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 18 package org.apache.commons.jxpath; 19 20 /** 21 * Extension function interface. Extension functions are grouped into {@link Functions Functions} objects, which are installed on JXPathContexts using the 22 * {@link JXPathContext#setFunctions JXPathContext.setFunctions()} call. 23 * <p> 24 * The Function interface can be implemented directly. However, most of the time JXPath's built-in implementations should suffice. See {@link ClassFunctions 25 * ClassFunctions} and {@link PackageFunctions PackageFunctions}. 26 */ 27 public interface Function { 28 29 /** 30 * Computes the value of the function. Each implementation of Function is responsible for conversion of supplied parameters to the required argument types. 31 * 32 * @param context can be used to acquire the context in which the function is being evaluted. 33 * @param parameters function arguments 34 * @return Object result 35 */ 36 Object invoke(ExpressionContext context, Object[] parameters); 37 }