org.kuali.rice.coreservice.api.component
Class Component.Builder

java.lang.Object
  extended by org.kuali.rice.coreservice.api.component.Component.Builder
All Implemented Interfaces:
Serializable, Inactivatable, Coded, GloballyUnique, Versioned, ModelBuilder, ComponentContract
Enclosing class:
Component

public static final class Component.Builder
extends Object
implements ComponentContract, ModelBuilder, Serializable

This builder is used to construct instances of Component. It enforces the constraints of the ComponentContract.

See Also:
Serialized Form

Method Summary
 Component build()
          Builds an instance of a Component based on the current state of the builder.
static Component.Builder create(ComponentContract contract)
          Creates a builder by populating it with data from the given ComponentContract.
static Component.Builder create(String namespaceCode, String code, String name)
          Constructs a Namespace builder given the namcespace code, component code, and name which are all required.
 String getCode()
          The code value for this object.
 String getComponentSetId()
          Returns the id of the component set this component belongs to if this component was published as part of such a component set.
 String getName()
          This is the name value for the component.
 String getNamespaceCode()
          This is the namespace for the component.
 String getObjectId()
          Return the globally unique object id of this object.
 Long getVersionNumber()
          Returns the version number for this object.
 boolean isActive()
          The active indicator for an object.
 void setActive(boolean active)
           
 void setCode(String code)
          Sets the value of the component code on this builder to the given value.
 void setComponentSetId(String componentSetId)
           
 void setName(String name)
          Sets the value of the component name on this builder to the given value.
 void setNamespaceCode(String namespaceCode)
          Sets the value of the namespace code on this builder to the given value.
 void setObjectId(String objectId)
           
 void setVersionNumber(Long versionNumber)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static Component.Builder create(String namespaceCode,
                                       String code,
                                       String name)
Constructs a Namespace builder given the namcespace code, component code, and name which are all required. Defaults the active indicator to true.

Parameters:
namespaceCode - the namespace code to use when constructing this builder
code - the component code to use when constructing this builder
name - the component name to use when constructing this builder
Throws:
IllegalArgumentException - if any of the parameters are null or blank

create

public static Component.Builder create(ComponentContract contract)
Creates a builder by populating it with data from the given ComponentContract.

Parameters:
contract - the contract from which to populate this builder
Returns:
an instance of the builder populated with data from the contract

setNamespaceCode

public void setNamespaceCode(String namespaceCode)
Sets the value of the namespace code on this builder to the given value.

Parameters:
namespaceCode - the namespace code value to set, must not be null or blank
Throws:
IllegalArgumentException - if the given namespace code is null or blank

setCode

public void setCode(String code)
Sets the value of the component code on this builder to the given value.

Parameters:
code - the component code value to set, must not be null or blank
Throws:
IllegalArgumentException - if the given component code is null or blank

setName

public void setName(String name)
Sets the value of the component name on this builder to the given value.

Parameters:
name - the component name value to set, must not be null or blank
Throws:
IllegalArgumentException - if the given component name is null or blank

isActive

public boolean isActive()
Description copied from interface: Inactivatable
The active indicator for an object.

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

setActive

public void setActive(boolean active)

getNamespaceCode

public String getNamespaceCode()
Description copied from interface: ComponentContract
This is the namespace for the component. It cannot be null or a blank string.

It is a way of assigning the component to a logical grouping within a rice application or rice ecosystem.

Specified by:
getNamespaceCode in interface ComponentContract
Returns:
namespace code

getCode

public String getCode()
Description copied from interface: Coded
The code value for this object. In general a code value cannot be null or a blank string.

Specified by:
getCode in interface Coded
Returns:
the code value for this object.

getName

public String getName()
Description copied from interface: ComponentContract
This is the name value for the component. It cannot be null or a blank string.

Specified by:
getName in interface ComponentContract
Returns:
name

getComponentSetId

public String getComponentSetId()
Description copied from interface: ComponentContract
Returns the id of the component set this component belongs to if this component was published as part of such a component set. Will return a null value if this component was not published as part of a component set.

Specified by:
getComponentSetId in interface ComponentContract
Returns:
the id of the component set this component was published under, or null if this component is not part of a published set

setComponentSetId

public void setComponentSetId(String componentSetId)

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)

getObjectId

public String getObjectId()
Description copied from interface: GloballyUnique
Return the globally unique object id of this object. In general, this value should only be null if the object has not yet been stored to a persistent data store.

Specified by:
getObjectId in interface GloballyUnique
Returns:
the objectId of this object, or null if it has not been set yet

setObjectId

public void setObjectId(String objectId)

build

public Component build()
Builds an instance of a Component based on the current state of the builder.

Specified by:
build in interface ModelBuilder
Returns:
the fully-constructed Component


Copyright © 2005–2014 The Kuali Foundation. All rights reserved.