org.jcon.data
Class ConditionalTransform

java.lang.Object
  extended by org.jcon.data.ConditionalTransform
All Implemented Interfaces:
java.io.Serializable, ObjectTransform

public class ConditionalTransform
extends java.lang.Object
implements java.io.Serializable, ObjectTransform

An ObjectTransform which can execute one of two subtransforms based on a condition.

See Also:
Serialized Form

Constructor Summary
ConditionalTransform()
          Create a new ConditionalTransform.
 
Method Summary
 ObjectTransform getElseTransform()
          Optional transform to run if ifCondition evaluates to false.
 UnaryPredicate getIfCondition()
          Condition which, if it evaluates to true, runs the thenTransform, otherwise runs the elseTransform if it exists.
 ObjectTransform getThenTransform()
          Transform run if ifCondition evaluates to true.
 void setElseTransform(ObjectTransform newElseTransform)
          Transform run if ifCondition evaluates to false.
 void setIfCondition(UnaryPredicate newIfCondition)
          Condition which, if it evaluates to true, runs the thenTransform, otherwise runs the elseTransform if it exists.
 void setThenTransform(ObjectTransform newThenTransform)
          Transform run if ifCondition evaluates to true.
 java.lang.Object transform(java.lang.Object victim)
          Our one method; this transforms one object into another.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConditionalTransform

public ConditionalTransform()
Create a new ConditionalTransform.

Method Detail

transform

public java.lang.Object transform(java.lang.Object victim)
Description copied from interface: ObjectTransform
Our one method; this transforms one object into another. Transformation must be nondestructive, but may produce a derived product that is still affected by changes to the original, so beware.

Specified by:
transform in interface ObjectTransform

getElseTransform

public ObjectTransform getElseTransform()
Optional transform to run if ifCondition evaluates to false. By default passes the object through unchanged.


setElseTransform

public void setElseTransform(ObjectTransform newElseTransform)
Transform run if ifCondition evaluates to false.


getIfCondition

public UnaryPredicate getIfCondition()
Condition which, if it evaluates to true, runs the thenTransform, otherwise runs the elseTransform if it exists.


setIfCondition

public void setIfCondition(UnaryPredicate newIfCondition)
Condition which, if it evaluates to true, runs the thenTransform, otherwise runs the elseTransform if it exists.


getThenTransform

public ObjectTransform getThenTransform()
Transform run if ifCondition evaluates to true.


setThenTransform

public void setThenTransform(ObjectTransform newThenTransform)
Transform run if ifCondition evaluates to true.