org.kuali.rice.shareddata.api.state
Class State.Builder

java.lang.Object
  extended by org.kuali.rice.shareddata.api.state.State.Builder
All Implemented Interfaces:
Serializable, org.kuali.rice.core.api.mo.ModelBuilder, StateContract
Enclosing class:
State

public static class State.Builder
extends Object
implements StateContract, org.kuali.rice.core.api.mo.ModelBuilder, Serializable

This builder constructs a State enforcing the constraints of the StateContract.

See Also:
Serialized Form

Method Summary
 State build()
           
static State.Builder create(StateContract contract)
          creates a Parameter from an existing StateContract.
static State.Builder create(String code, String name, String countryCode)
          creates a State with the required fields.
 String getCode()
          This the postal state code for the State.
 String getCountryCode()
          This the postal country code for the State.
 String getName()
          This the postal name for the State.
 Long getVersionNumber()
          This the object version number for State.
 boolean isActive()
          This the active flag for the State.
 void setActive(boolean active)
           
 void setCode(String code)
          Sets the code to be used for the State created from this Builder.
 void setCountryCode(String countryCode)
          Sets the Country code to be associated with the State created from this Builder.
 void setName(String name)
          Sets the full name of the State created from this Builder.
 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 State.Builder create(String code,
                                   String name,
                                   String countryCode)
creates a State with the required fields.

Parameters:
code - represents code for the State being built
name - represents full name for the State being built
countryCode - code for the Country this State is associated with
Returns:
a bootstrapped Builder defaulted with the passed in code, name, and countryCode.

create

public static State.Builder create(StateContract contract)
creates a Parameter from an existing StateContract.


getCode

public String getCode()
Description copied from interface: StateContract
This the postal state code for the State. This cannot be null or a blank string.

Specified by:
getCode in interface StateContract
Returns:
postal state code

setCode

public void setCode(String code)
Sets the code to be used for the State created from this Builder.

Parameters:
code - String code for a State.
Throws:
IllegalArgumentException - if the passed in code is null or a blank String.

getName

public String getName()
Description copied from interface: StateContract
This the postal name for the State. This cannot be null or a blank string.

Specified by:
getName in interface StateContract
Returns:
postal name

setName

public void setName(String name)
Sets the full name of the State created from this Builder.

Parameters:
name - String representing the full name for the State
Throws:
IllegalArgumentException - if the passed in name is null or a blank String.

getCountryCode

public String getCountryCode()
Description copied from interface: StateContract
This the postal country code for the State. This cannot be null or a blank string.

Specified by:
getCountryCode in interface StateContract
Returns:
postal country code

setCountryCode

public void setCountryCode(String countryCode)
Sets the Country code to be associated with the State created from this Builder.

Parameters:
countryCode - String representing the Country Code
Throws:
IllegalArgumentException - if the passed in countryCode is null or a blank String.

isActive

public boolean isActive()
Description copied from interface: StateContract
This the active flag for the State.

Specified by:
isActive in interface StateContract
Returns:
the active flag of the State

setActive

public void setActive(boolean active)

getVersionNumber

public Long getVersionNumber()
Description copied from interface: StateContract
This the object version number for State.

Specified by:
getVersionNumber in interface StateContract
Returns:
the version number of the State

setVersionNumber

public void setVersionNumber(Long versionNumber)

build

public State build()
Specified by:
build in interface org.kuali.rice.core.api.mo.ModelBuilder


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