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 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 a FunctionDefinition object 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 blank
      name - the name of the function definition to create, must not be null or blank
      returnType - the return type of the function definition to create, must not be null or blank
      typeId - 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

      public static FunctionDefinition.Builder create(FunctionDefinitionContract contract)
      Creates and populates a builder with the data on the given FunctionDefinitionContract. This is similar in nature to a "copy constructor" for FunctionDefinition.
      Parameters:
      contract - an object implementing the FunctionDefinitionContract from 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

      public FunctionDefinition build()
      Specified by:
      build in interface ModelBuilder
    • getId

      public String getId()
      Specified by:
      getId in interface Identifiable
    • setId

      public void setId(String id)
      Sets the id for the function definition that will be returned by this builder.
      Parameters:
      id - the function definition id to set
    • getNamespace

      public String getNamespace()
      Description copied from interface: FunctionDefinitionContract
      Returns 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:
      getNamespace in interface FunctionDefinitionContract
      Returns:
      the namespace code of this function definition
    • setNamespace

      public void setNamespace(String namespace)
      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

      public String getName()
      Description copied from interface: FunctionDefinitionContract
      Returns 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:
      getName in interface FunctionDefinitionContract
      Returns:
      the name of this function definition
    • setName

      public void setName(String name)
      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

      public String getDescription()
      Description copied from interface: FunctionDefinitionContract
      Returns 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:
      getDescription in interface FunctionDefinitionContract
      Returns:
      the description of this function definition
    • setDescription

      public void setDescription(String description)
      Sets the description for the function definition that will be returned by this builder.
      Parameters:
      description - the description to set on this builder
    • getReturnType

      public String getReturnType()
      Description copied from interface: FunctionDefinitionContract
      Returns 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:
      getReturnType in interface FunctionDefinitionContract
      Returns:
      the return type of this function definition
    • setReturnType

      public void setReturnType(String returnType)
      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

      public String getTypeId()
      Description copied from interface: FunctionDefinitionContract
      Returns the id of the KrmsTypeDefinition which defines the actual implementation of this function such that it can be loaded into the engine and executed.
      Specified by:
      getTypeId in interface FunctionDefinitionContract
      Returns:
      the type id of this function definition
    • setTypeId

      public void setTypeId(String typeId)
      Sets the id of the KrmsTypeDefinition which 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:
      isActive in interface Inactivatable
    • 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

      public Long getVersionNumber()
      Specified by:
      getVersionNumber in interface Versioned
    • setVersionNumber

      public void setVersionNumber(Long versionNumber)
      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 FunctionDefinitionContract when invoking create(FunctionDefinitionContract).

      Parameters:
      versionNumber - the version number to set
    • getParameters

      public List<FunctionParameterDefinition.Builder> getParameters()
      Description copied from interface: FunctionDefinitionContract
      Returns 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:
      getParameters in interface FunctionDefinitionContract
      Returns:
      the list of parameters for this function definition
    • setParameters

      public void setParameters(List<FunctionParameterDefinition.Builder> parameters)
      Sets the parameters for the function definition that will be returned by this builder. This list is a list of builders for each of the FunctionParameterDefinition instances 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

      public List<CategoryDefinition.Builder> getCategories()
      Description copied from interface: FunctionDefinitionContract
      Returns 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:
      getCategories in interface FunctionDefinitionContract
      Returns:
      the list of categories for this function definition
    • setCategories

      public void setCategories(List<CategoryDefinition.Builder> categories)
      Sets the category for the function definition that will be returned by this builder. This list is a list of builders for each of the CategoryDefinition instances 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