org.kuali.rice.coreservice.api.style
Class Style.Builder

java.lang.Object
  extended by org.kuali.rice.coreservice.api.style.Style.Builder
All Implemented Interfaces:
Serializable, Inactivatable, GloballyUnique, Identifiable, Versioned, ModelBuilder, StyleContract
Enclosing class:
Style

public static final class Style.Builder
extends Object
implements StyleContract, ModelBuilder, Serializable

A builder which can be used to construct Style instances. Enforces the constraints of the StyleContract.

Author:
Kuali Rice Team (rice.collab@kuali.org)
See Also:
Serialized Form

Method Summary
 Style build()
          Returns an instance of the object being built by this builder based on the current state of the builder.
static Style.Builder create(String name)
          Creates a style builder with the given required values.
static Style.Builder create(StyleContract contract)
          Creates a populates a builder with the data on the given StyleContract.
 String getId()
          The unique identifier for an object.
 String getName()
          Returns the name of this style.
 String getObjectId()
          Return the globally unique object id of this object.
 Long getVersionNumber()
          Returns the version number for this object.
 String getXmlContent()
          Returns the XML definition of this style as a String.
 boolean isActive()
          The active indicator for an object.
 void setActive(boolean active)
          Sets the active flag for the style that will be returned by this builder.
 void setId(String id)
          Sets the id for the style that will be returned by this builder.
 void setName(String name)
          Sets the name for the style that will be returned by this builder.
 void setObjectId(String objectId)
          Sets the globally unique object ID for the style that will be returned by this builder.
 void setVersionNumber(Long versionNumber)
          Sets the version number for the style that will be returned by this builder.
 void setXmlContent(String xmlContent)
          Sets the XML content for the style 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
 

Method Detail

create

public static Style.Builder create(String name)
Creates a style builder with the given required values. The builder is the only means by which a Style object should be created.

Will default the active flag to true.

Parameters:
name - the name of the style to create, must not be null or blank
Returns:
a builder with the required values already initialized
Throws:
IllegalArgumentException - if the given name is null or blank

create

public static Style.Builder create(StyleContract contract)
Creates a populates a builder with the data on the given StyleContract. This is similar in nature to a "copy constructor" for Style.

Parameters:
contract - an object implementing the StyleContract 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 Style 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 style that will be returned by this builder.

Parameters:
id - the id to set

getName

public String getName()
Description copied from interface: StyleContract
Returns the name of this style. All styles have a name and this value can never be null or blank. The name must be unique within the entire repository of existing styles.

Specified by:
getName in interface StyleContract
Returns:
the name of this style

setName

public void setName(String name)
Sets the name for the style that will be returned by this builder. The name must not be blank or null.

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

getXmlContent

public String getXmlContent()
Description copied from interface: StyleContract
Returns the XML definition of this style as a String.

Specified by:
getXmlContent in interface StyleContract
Returns:
the xml definition of this style

setXmlContent

public void setXmlContent(String xmlContent)
Sets the XML content for the style that will be returned by this builder.

Parameters:
xmlContent - the xmlContent to set on this builder

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)
Sets the active flag for the style 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 style 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 StyleContract when invoking create(StyleContract).

Parameters:
versionNumber - the version number to set

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)
Sets the globally unique object ID for the style 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 StyleContract when invoking create(StyleContract).

Parameters:
objectId - the object ID to set


Copyright © 2005-2013 The Kuali Foundation. All Rights Reserved.