| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| FunctionDefinitionContract |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Copyright 2011 The Kuali Foundation | |
| 3 | * | |
| 4 | * Licensed under the Educational Community License, Version 1.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.opensource.org/licenses/ecl1.php | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 15 | */ | |
| 16 | package org.kuali.rice.krms.api.repository.function; | |
| 17 | ||
| 18 | import org.kuali.rice.core.api.mo.common.Identifiable; | |
| 19 | import org.kuali.rice.core.api.mo.common.Versioned; | |
| 20 | import org.kuali.rice.core.api.mo.common.active.Inactivatable; | |
| 21 | import org.kuali.rice.krms.api.repository.type.KrmsTypeDefinition; | |
| 22 | ||
| 23 | import java.util.List; | |
| 24 | ||
| 25 | /** | |
| 26 | * Defines the contract for a function definition. A function definition can be | |
| 27 | * defined by clients integrating with KRMS in order to implement custom logic | |
| 28 | * which they may require as part of rule execution and evaluation. These can | |
| 29 | * then be used in simple propositions. | |
| 30 | * | |
| 31 | * <p>The function definition itself defines various metadata about the function | |
| 32 | * including it's name, return type, and expected parameter types. The actual | |
| 33 | * implementation of the function is retrieved through the type defined by | |
| 34 | * {@link #getTypeId()}. | |
| 35 | * | |
| 36 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 37 | * | |
| 38 | */ | |
| 39 | public interface FunctionDefinitionContract extends Versioned, Identifiable, Inactivatable { | |
| 40 | ||
| 41 | /** | |
| 42 | * Returns the namespace code of this function definition. All functions | |
| 43 | * have a namespace and this value can never be null or blank. The | |
| 44 | * combination of namespace plus name must be unique within the entire | |
| 45 | * repository of functions. | |
| 46 | * | |
| 47 | * @return the namespace code of this function definition | |
| 48 | */ | |
| 49 | String getNamespace(); | |
| 50 | ||
| 51 | /** | |
| 52 | * Returns the name of this function definition. All functions have a name | |
| 53 | * and this value can never be null or blank. The combination of namespace | |
| 54 | * plus name must be unique within the entire repository of functions. | |
| 55 | * | |
| 56 | * @return the name of this function definition | |
| 57 | */ | |
| 58 | String getName(); | |
| 59 | ||
| 60 | /** | |
| 61 | * Returns the description of this function definition. The description is | |
| 62 | * intended to provide more information about a function and it's | |
| 63 | * appropriate usage. The description is optional. | |
| 64 | * | |
| 65 | * @return the description of this function definition | |
| 66 | */ | |
| 67 | String getDescription(); | |
| 68 | ||
| 69 | /** | |
| 70 | * Returns the type of the return value of the function defined by this | |
| 71 | * function definition. This can be one of a set of "built-in" data types | |
| 72 | * or a custom data type represented as a fully qualified java class name. | |
| 73 | * All functions must have a return type so this method should never return | |
| 74 | * null or blank. | |
| 75 | * | |
| 76 | * @return the return type of this function definition | |
| 77 | */ | |
| 78 | String getReturnType(); | |
| 79 | ||
| 80 | /** | |
| 81 | * Returns the id of the {@link KrmsTypeDefinition} which defines the | |
| 82 | * actual implementation of this function such that it can be loaded into | |
| 83 | * the engine and executed. | |
| 84 | * | |
| 85 | * @return the type id of this function definition | |
| 86 | */ | |
| 87 | String getTypeId(); | |
| 88 | ||
| 89 | /** | |
| 90 | * Returns an ordered, immutable list of the parameters which this function | |
| 91 | * definition requires. This list can be empty (in the case of a function | |
| 92 | * which has no arguments) but will never be null. | |
| 93 | * | |
| 94 | * @return the list of parameters for this function definition | |
| 95 | */ | |
| 96 | List<? extends FunctionParameterDefinitionContract> getParameters(); | |
| 97 | ||
| 98 | } |