T
- public class ConvertType<T> extends java.lang.Object implements ArooaValue, ArooaSessionAware
This type uses Oddjob's internal converters itself to perform the conversion.
The is
property can provide direct access to the converted
value. This can be useful for gaining access to a Java type from Oddjob's
wrapper types.
<oddjob id="this"> <job> <foreach> <values> <convert> <to> <class name="[Ljava.lang.String;"/> </to> <value> <value value=""grapes, red", "grapes, white", gratefruit"/> </value> </convert> </values> <configuration> <xml> <foreach id="loop"> <job> <echo>${loop.current}</echo> </job> </foreach> </xml> </configuration> </foreach> </job> </oddjob>The output is:
grapes, red grapes, white gratefruit
<oddjob id="this"> <job> <sequential> <jobs> <variables id="vars"> <aNumber> <convert> <to> <class name="java.lang.Integer"/> </to> <value> <value value="42"/> </value> </convert> </aNumber> </variables> <echo>${vars.aNumber} ${vars.aNumber.class} ${vars.aNumber.value} ${vars.aNumber.value.class} ${vars.aNumber.is} ${vars.aNumber.is.class}</echo> </jobs> </sequential> </job> </oddjob>The output is:
42 class org.oddjob.arooa.types.ConvertType 42 class org.oddjob.arooa.types.ValueType 42 class java.lang.Integer
Modifier and Type | Class and Description |
---|---|
static class |
ConvertType.Conversions |
Modifier and Type | Field and Description |
---|---|
static ArooaElement |
ELEMENT |
Constructor and Description |
---|
ConvertType() |
Modifier and Type | Method and Description |
---|---|
void |
configured() |
T |
convert()
Proivde the conversion.
|
java.lang.Object |
getIs() |
java.lang.Class<T> |
getTo() |
ArooaValue |
getValue() |
void |
setArooaSession(ArooaSession session)
Accept the current Arooa Session.
|
void |
setTo(java.lang.Class<T> to) |
void |
setValue(ArooaValue from) |
java.lang.String |
toString() |
public static final ArooaElement ELEMENT
public void setArooaSession(ArooaSession session)
ArooaSessionAware
setArooaSession
in interface ArooaSessionAware
session
- The Arooa Session. Never null.public void configured() throws NoConversionAvailableException, ConversionFailedException
public T convert() throws NoConversionAvailableException, ConversionFailedException
ConversionFailedException
NoConversionAvailableException
public java.lang.Class<T> getTo()
public void setTo(java.lang.Class<T> to)
public ArooaValue getValue()
public void setValue(ArooaValue from)
public java.lang.Object getIs()
public java.lang.String toString()
toString
in class java.lang.Object