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

java.lang.Object
  extended by org.kuali.rice.location.api.state.State.Builder
All Implemented Interfaces:
Serializable, Inactivatable, Coded, Versioned, ModelBuilder, StateContract
Enclosing class:
State

public static class State.Builder
extends Object
implements StateContract, ModelBuilder, Serializable

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

See Also:
Serialized Form

Method Summary
 State build()
          Returns an instance of the object being built by this builder based on the current state of the builder.
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()
          The code value for this object.
 String getCountryCode()
          This the postal country code for the State.
 String getName()
          This the postal name for the State.
 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 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: 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.

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: 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)

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)

build

public State 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


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