org.kuali.rice.krms.api.repository.function
Class FunctionDefinition.Builder

java.lang.Object
  extended by org.kuali.rice.krms.api.repository.function.FunctionDefinition.Builder
All Implemented Interfaces:
Serializable, ImmutableInactivatable, 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:
Serialized Form

Field Summary
private  boolean active
           
private  List<CategoryDefinition.Builder> categories
           
private  String description
           
private  String id
           
private  String name
           
private  String namespace
           
private  List<FunctionParameterDefinition.Builder> parameters
           
private  String returnType
           
private static long serialVersionUID
           
private  String typeId
           
private  Long versionNumber
           
 
Constructor Summary
private FunctionDefinition.Builder(String namespace, String name, String returnType, String typeId)
           
 
Method Summary
 FunctionDefinition build()
          Returns an instance of the object being built by this builder based on the current state of the builder.
static FunctionDefinition.Builder create(FunctionDefinitionContract contract)
          Creates and populates a builder with the data on the given FunctionDefinitionContract.
static FunctionDefinition.Builder create(String namespace, String name, String returnType, String typeId)
          Creates a function definition builder with the given required values.
 List<CategoryDefinition.Builder> getCategories()
          Returns an ordered, immutable list of the categories which this function definition requires.
 String getDescription()
          Returns the description of this function definition.
 String getId()
          The unique identifier for an object.
 String getName()
          Returns the name of this function definition.
 String getNamespace()
          Returns the namespace code of this function definition.
 List<FunctionParameterDefinition.Builder> getParameters()
          Returns an ordered, immutable list of the parameters which this function definition requires.
 String getReturnType()
          Returns the type of the return value of the function defined by this function definition.
 String getTypeId()
          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.
 Long getVersionNumber()
          Returns the version number for this object.
 boolean isActive()
          The active indicator for an object.
 void setActive(boolean active)
          Sets the active flag for the function definition that will be returned by this builder.
 void setCategories(List<CategoryDefinition.Builder> categories)
          Sets the category for the function definition that will be returned by this builder.
 void setDescription(String description)
          Sets the description for the function definition that will be returned by this builder.
 void setId(String id)
          Sets the id for the function definition that will be returned by this builder.
 void setName(String name)
          Sets the name for the function definition that will be returned by this builder.
 void setNamespace(String namespace)
          Sets the namespace code for the function definition that will be returned by this builder.
 void setParameters(List<FunctionParameterDefinition.Builder> parameters)
          Sets the parameters for the function definition that will be returned by this builder.
 void setReturnType(String returnType)
          Sets the return type for the function definition that will be returned by this builder.
 void setTypeId(String typeId)
          Sets the id of the KrmsTypeDefinition which defines the actual implementation of this function.
 void setVersionNumber(Long versionNumber)
          Sets the version number for the function definition that will be returned by this builder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

id

private String id

namespace

private String namespace

name

private String name

description

private String description

returnType

private String returnType

typeId

private String typeId

active

private boolean active

versionNumber

private Long versionNumber

parameters

private List<FunctionParameterDefinition.Builder> parameters

categories

private List<CategoryDefinition.Builder> categories
Constructor Detail

FunctionDefinition.Builder

private FunctionDefinition.Builder(String namespace,
                                   String name,
                                   String returnType,
                                   String typeId)
Method Detail

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()
Description copied from interface: ModelBuilder
Returns an instance of the object being built by this builder based on the current state of the builder. It should be possible to invoke this method more than once on the same builder. It should never return null;

Specified by:
build in interface ModelBuilder
Returns:
an instance of the object being built by this builder, should never return null

getId

public String getId()
Description copied from interface: Identifiable
The unique identifier for an object. This can be null.

Specified by:
getId in interface Identifiable
Returns:
the id

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()
Description copied from interface: ImmutableInactivatable
The active indicator for an object.

Specified by:
isActive in interface ImmutableInactivatable
Returns:
true if active false if not.

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()
Description copied from interface: Versioned
Returns the version number for this object. In general, this value should only be null if the object has not yet been stored to a persistent data store. This version number is generally used for the purposes of optimistic locking.

Specified by:
getVersionNumber in interface Versioned
Returns:
the version number, or null if one has not been assigned yet

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, immutable 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


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.