Class FunctionDefinition.Builder
java.lang.Object
org.kuali.rice.krms.api.repository.function.FunctionDefinition.Builder
- All Implemented Interfaces:
Serializable,Inactivatable,Identifiable,Versioned,ModelBuilder,FunctionDefinitionContract
- Enclosing class:
FunctionDefinition
public static final class FunctionDefinition.Builder
extends Object
implements FunctionDefinitionContract, ModelBuilder, Serializable
A builder which can be used to construct
FunctionDefinition
instances. Enforces the constraints of the FunctionDefinitionContract.- Author:
- Kuali Rice Team (rice.collab@kuali.org)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbuild()static FunctionDefinition.BuilderCreates a function definition builder with the given required values.static FunctionDefinition.Buildercreate(FunctionDefinitionContract contract) Creates and populates a builder with the data on the givenFunctionDefinitionContract.Returns an ordered list of the categories which this function definition requires.Returns the description of this function definition.getId()getName()Returns the name of this function definition.Returns the namespace code of this function definition.Returns an ordered, immutable list of the parameters which this function definition requires.Returns the type of the return value of the function defined by this function definition.Returns the id of theKrmsTypeDefinitionwhich defines the actual implementation of this function such that it can be loaded into the engine and executed.booleanisActive()voidsetActive(boolean active) Sets the active flag for the function definition that will be returned by this builder.voidsetCategories(List<CategoryDefinition.Builder> categories) Sets the category for the function definition that will be returned by this builder.voidsetDescription(String description) Sets the description for the function definition that will be returned by this builder.voidSets the id for the function definition that will be returned by this builder.voidSets the name for the function definition that will be returned by this builder.voidsetNamespace(String namespace) Sets the namespace code for the function definition that will be returned by this builder.voidsetParameters(List<FunctionParameterDefinition.Builder> parameters) Sets the parameters for the function definition that will be returned by this builder.voidsetReturnType(String returnType) Sets the return type for the function definition that will be returned by this builder.voidSets the id of theKrmsTypeDefinitionwhich defines the actual implementation of this function.voidsetVersionNumber(Long versionNumber) Sets the version number for the function definition that will be returned by this builder.
-
Method Details
-
create
public static FunctionDefinition.Builder create(String namespace, String name, String returnType, String typeId) Creates a function definition builder with the given required values. This builder is the only means by which aFunctionDefinitionobject should be created.Will default the active flag to true.
- Parameters:
namespace- the namespace of the function definition to create, must not be null or blankname- the name of the function definition to create, must not be null or blankreturnType- the return type of the function definition to create, must not be null or blanktypeId- the return type id of the function definition to create, must not be null or blank- Returns:
- a builder with the required values already initialized
- Throws:
IllegalArgumentException- if any of the given arguments is null or blank
-
create
Creates and populates a builder with the data on the givenFunctionDefinitionContract. This is similar in nature to a "copy constructor" forFunctionDefinition.- Parameters:
contract- an object implementing theFunctionDefinitionContractfrom which to copy property values- Returns:
- a builder with the values from the contract already initialized
- Throws:
IllegalArgumentException- if the given contract is null
-
build
- Specified by:
buildin interfaceModelBuilder
-
getId
- Specified by:
getIdin interfaceIdentifiable
-
setId
Sets the id for the function definition that will be returned by this builder.- Parameters:
id- the function definition id to set
-
getNamespace
Description copied from interface:FunctionDefinitionContractReturns the namespace code of this function definition. All functions have a namespace and this value can never be null or blank. The combination of namespace plus name must be unique within the entire repository of functions.- Specified by:
getNamespacein interfaceFunctionDefinitionContract- Returns:
- the namespace code of this function definition
-
setNamespace
Sets the namespace code for the function definition that will be returned by this builder. The namespace must not be null or blank.- Parameters:
namespace- the namespace code to set on this builder, must not be null or blank- Throws:
IllegalArgumentException- if the given namespace is null or blank
-
getName
Description copied from interface:FunctionDefinitionContractReturns the name of this function definition. All functions have a name and this value can never be null or blank. The combination of namespace plus name must be unique within the entire repository of functions.- Specified by:
getNamein interfaceFunctionDefinitionContract- Returns:
- the name of this function definition
-
setName
Sets the name for the function definition that will be returned by this builder. The name must not be null or blank.- Parameters:
name- the name to set on this builder, must not be null or blank- Throws:
IllegalArgumentException- if the given name is null or blank
-
getDescription
Description copied from interface:FunctionDefinitionContractReturns the description of this function definition. The description is intended to provide more information about a function and it's appropriate usage. The description is optional.- Specified by:
getDescriptionin interfaceFunctionDefinitionContract- Returns:
- the description of this function definition
-
setDescription
Sets the description for the function definition that will be returned by this builder.- Parameters:
description- the description to set on this builder
-
getReturnType
Description copied from interface:FunctionDefinitionContractReturns the type of the return value of the function defined by this function definition. This can be one of a set of "built-in" data types or a custom data type represented as a fully qualified java class name. All functions must have a return type so this method should never return null or blank.- Specified by:
getReturnTypein interfaceFunctionDefinitionContract- Returns:
- the return type of this function definition
-
setReturnType
Sets the return type for the function definition that will be returned by this builder. This can be one of a set of "built-in" data types or a custom datatype represented as a fully qualified java class name. The returnType must not be null or blank.- Parameters:
returnType- the returnType to set on this builder, must not be null or blank- Throws:
IllegalArgumentException- if the given returnType is null or blank
-
getTypeId
Description copied from interface:FunctionDefinitionContractReturns the id of theKrmsTypeDefinitionwhich defines the actual implementation of this function such that it can be loaded into the engine and executed.- Specified by:
getTypeIdin interfaceFunctionDefinitionContract- Returns:
- the type id of this function definition
-
setTypeId
Sets the id of theKrmsTypeDefinitionwhich defines the actual implementation of this function. The typeId must not be null or blank.- Parameters:
typeId- the typeId to set on this builder, must not be null or blank- Throws:
IllegalArgumentException- if the given typeId is null or blank
-
isActive
public boolean isActive()- Specified by:
isActivein interfaceInactivatable
-
setActive
public void setActive(boolean active) Sets the active flag for the function definition that will be returned by this builder.- Parameters:
active- the active flag to set
-
getVersionNumber
- Specified by:
getVersionNumberin interfaceVersioned
-
setVersionNumber
Sets the version number for the function definition that will be returned by this builder.In general, this value should not be manually set on the builder, but rather copied from an existing
FunctionDefinitionContractwhen invokingcreate(FunctionDefinitionContract).- Parameters:
versionNumber- the version number to set
-
getParameters
Description copied from interface:FunctionDefinitionContractReturns an ordered, immutable list of the parameters which this function definition requires. This list can be empty (in the case of a function which has no arguments) but will never be null.- Specified by:
getParametersin interfaceFunctionDefinitionContract- Returns:
- the list of parameters for this function definition
-
setParameters
Sets the parameters for the function definition that will be returned by this builder. This list is a list of builders for each of theFunctionParameterDefinitioninstances that will form the parameters of this function definition. The given list must not be null.- Parameters:
parameters- a list of builders for the parameters which will be specified on this function definition- Throws:
IllegalArgumentException- if the given parameters list is null
-
getCategories
Description copied from interface:FunctionDefinitionContractReturns an ordered list of the categories which this function definition requires. This list can be empty (in the case of a function which has no arguments) but will never be null.- Specified by:
getCategoriesin interfaceFunctionDefinitionContract- Returns:
- the list of categories for this function definition
-
setCategories
Sets the category for the function definition that will be returned by this builder. This list is a list of builders for each of theCategoryDefinitioninstances that will form the categories of this function definition. The given list must not be null.- Parameters:
categories- a list of builders for the categories which will be specified on this function definition- Throws:
IllegalArgumentException- if the given categories list is null
-