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
 void configured()
           
 T convert()
          Proivde the conversion.
 Object getIs()
           
 Class<T> getTo()
           
 ArooaValue getValue()
           
 void setArooaSession(ArooaSession session)
           
 void setTo(Class<T> to)
           
 void setValue(ArooaValue from)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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

configured

public void configured()
                throws NoConversionAvailableException,
                       ConversionFailedException
Throws:
NoConversionAvailableException
ConversionFailedException

convert

public T convert()
          throws NoConversionAvailableException,
                 ConversionFailedException
Proivde the conversion.

Returns:
Throws:
ConversionFailedException
NoConversionAvailableException

getTo

public Class<T> getTo()

setTo

public void setTo(Class<T> to)

getValue

public ArooaValue getValue()

setValue

public void setValue(ArooaValue from)

getIs

public Object getIs()

toString

public String toString()
Overrides:
toString in class Object