org.oddjob.arooa.types
Class ConvertType<T>

java.lang.Object
  extended by org.oddjob.arooa.types.ConvertType<T>
Type Parameters:
T -
All Implemented Interfaces:
ArooaValue, ArooaSessionAware

public class ConvertType<T>
extends Object
implements ArooaValue, ArooaSessionAware

Description

Convert a value to the given Java Class.

Example

Convert a delimited list to an array of Strings.
<oddjob id="this">
    <job>
        <foreach>
            <values>
                <convert>
                    <to>
                        <class name="[Ljava.lang.String;"/>
                    </to>
                    <value>
                        <value value="&quot;grapes, red&quot;, &quot;grapes, white&quot;, gratefruit"/>
                    </value>
                </convert>
            </values>
            <configuration>
                <xml>
                    <foreach id="loop">
                        <job>
                            <echo>${loop.current}</echo>
                        </job>
                    </foreach>
                </xml>
            </configuration>
        </foreach>
    </job>
</oddjob>
Author:
rob

Nested Class Summary
static class ConvertType.Conversions
           
 
Field Summary
static ArooaElement ELEMENT
           
 
Constructor Summary
ConvertType()
           
 
Method Summary
 T convert()
           
 Class<T> getTo()
           
 Object getValue()
           
 void setArooaSession(ArooaSession session)
           
 void setTo(Class<T> to)
           
 void setValue(Object from)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ELEMENT

public static final ArooaElement ELEMENT
Constructor Detail

ConvertType

public ConvertType()
Method Detail

setArooaSession

public void setArooaSession(ArooaSession session)
Specified by:
setArooaSession in interface ArooaSessionAware

convert

public T convert()
          throws ArooaConversionException
Throws:
ArooaConversionException

getTo

public Class<T> getTo()

setTo

public void setTo(Class<T> to)

getValue

public Object getValue()

setValue

public void setValue(Object from)