org.nodal.util
Class SetterUtil

java.lang.Object
  extended byorg.nodal.util.GetterFilter
      extended byorg.nodal.util.SetterUtil
All Implemented Interfaces:
Getter, Setter, TxnMonitorable
Direct Known Subclasses:
NodeSetterUtil

public class SetterUtil
extends GetterFilter
implements Setter

An implementation of the Setter interface that takes an Object value. It may be used directly by initializing with a GetterUtil/PlainSetter pair or may be overridden by inheritance.


Nested Class Summary
static interface SetterUtil.PlainSetter
          Implement this interface to use SetterUtil.
 
Field Summary
protected  SetterUtil.PlainSetter plain
           
protected  GetterUtil util
           
 
Fields inherited from class org.nodal.util.GetterFilter
getter
 
Constructor Summary
protected SetterUtil(GetterUtil g, SetterUtil.PlainSetter s)
           
 
Method Summary
static SetterUtil create(GetterUtil g, SetterUtil.PlainSetter s)
          Create a new SetterUtil, selecting the appropriate implementation type based on the type() of the GetterUtil g.
 java.lang.Object set(java.lang.Object val)
          Set the value to an Object.
 boolean setBoolean(boolean b)
          Set the value to true/false.
 byte setByte(byte b)
          Set the value to a byte.
 char setChar(char c)
          Set the value to a character.
 double setDouble(double d)
          Set the value to a double precision floating point value.
 float setFloat(float f)
          Set the value to a single precision floating point value.
 int setInt(int i)
          Set the value to an integer.
 long setLong(long l)
           
 Node setNode(Node n)
          Set the value to a Node.
 short setShort(short s)
          Set the value to a short integer..
 java.lang.String setString(java.lang.String s)
          Set the value to that parsed from a String.
protected  java.lang.Object setValue(java.lang.Object val)
          Actually modify the value.
 
Methods inherited from class org.nodal.util.GetterFilter
addTxnHandler, get, getBoolean, getByte, getChar, getDouble, getFloat, getInt, getLong, getNode, getShort, getString, path, removeTxnHandler, type, valueEquals
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.nodal.model.Getter
get, getBoolean, getByte, getChar, getDouble, getFloat, getInt, getLong, getNode, getShort, getString, path, type, valueEquals
 
Methods inherited from interface org.nodal.model.TxnMonitorable
addTxnHandler, removeTxnHandler
 

Field Detail

plain

protected final SetterUtil.PlainSetter plain

util

protected final GetterUtil util
Constructor Detail

SetterUtil

protected SetterUtil(GetterUtil g,
                     SetterUtil.PlainSetter s)
Method Detail

create

public static final SetterUtil create(GetterUtil g,
                                      SetterUtil.PlainSetter s)
Create a new SetterUtil, selecting the appropriate implementation type based on the type() of the GetterUtil g.

Parameters:
g - a GetterUtil that is the accessor for this slot
s - a PlainSetter that accomplished the actual modification
Returns:
a new SetterUtil instance that will handle this modification

setValue

protected java.lang.Object setValue(java.lang.Object val)
                             throws ConstraintFailure
Actually modify the value. Signals the change for the Monitors of the GetterUtil component.

Throws:
ConstraintFailure

set

public java.lang.Object set(java.lang.Object val)
                     throws ConstraintFailure
Description copied from interface: Setter
Set the value to an Object. Will call setString or setNode if appropriate.

Specified by:
set in interface Setter
Parameters:
val - the new value for the slot
Returns:
the Object that was Set
Throws:
ConstraintFailure

setString

public java.lang.String setString(java.lang.String s)
                           throws ConstraintFailure
Description copied from interface: Setter
Set the value to that parsed from a String.

Specified by:
setString in interface Setter
Parameters:
s - a String representing the new value for the slot
Returns:
the String as set
Throws:
ConstraintFailure

setNode

public Node setNode(Node n)
             throws ConstraintFailure
Description copied from interface: Setter
Set the value to a Node. The Node returned should have a Path that reflects its new position in the NODAL hierarchy.

Specified by:
setNode in interface Setter
Parameters:
n - the new Node value for the slot
Returns:
a Node reference with Path defined by the Setter context
Throws:
ConstraintFailure

setBoolean

public boolean setBoolean(boolean b)
                   throws ConstraintFailure
Description copied from interface: Setter
Set the value to true/false.

Specified by:
setBoolean in interface Setter
Parameters:
b - the new boolean value
Returns:
the value as set
Throws:
ConstraintFailure

setChar

public char setChar(char c)
             throws ConstraintFailure
Description copied from interface: Setter
Set the value to a character.

Specified by:
setChar in interface Setter
Parameters:
c - the new character value
Returns:
the value as set
Throws:
ConstraintFailure

setByte

public byte setByte(byte b)
             throws ConstraintFailure
Description copied from interface: Setter
Set the value to a byte.

Specified by:
setByte in interface Setter
Parameters:
b - the new byte value
Returns:
the value as set
Throws:
ConstraintFailure

setShort

public short setShort(short s)
               throws ConstraintFailure
Description copied from interface: Setter
Set the value to a short integer..

Specified by:
setShort in interface Setter
Parameters:
s - the new short value
Returns:
the value as set
Throws:
ConstraintFailure

setInt

public int setInt(int i)
           throws ConstraintFailure
Description copied from interface: Setter
Set the value to an integer.

Specified by:
setInt in interface Setter
Parameters:
i - the new integer value
Returns:
the value as set
Throws:
ConstraintFailure

setLong

public long setLong(long l)
             throws ConstraintFailure
Throws:
ConstraintFailure

setFloat

public float setFloat(float f)
               throws ConstraintFailure
Description copied from interface: Setter
Set the value to a single precision floating point value.

Specified by:
setFloat in interface Setter
Parameters:
f - the new float value
Returns:
the value as set
Throws:
ConstraintFailure

setDouble

public double setDouble(double d)
                 throws ConstraintFailure
Description copied from interface: Setter
Set the value to a double precision floating point value.

Specified by:
setDouble in interface Setter
Parameters:
d - the new double value
Returns:
the value as set
Throws:
ConstraintFailure