|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.milyn.javabean.BindingAppender
org.milyn.javabean.Value
public class Value
Programmatic Value Configurator.
This class can be used to programmatically configure a Smooks instance for creating value objects using the Smooks DataDecoders. This class uses a Fluent API (all methods return the Bean instance), making it easy to string configurations together.
<order xmlns="http://x">
<header>
<y:date xmlns:y="http://y">Wed Nov 15 13:45:28 EST 2006</y:date>
<customer number="123123">Joe</customer>
<privatePerson></privatePerson>
</header>
<order-items>
<!-- .... --!>
</order-items>
</order>
Smooks smooks = new Smooks();
Value customerNumberValue = new Value( "customerNumber", "customer/@number")
.setDecoder("Integer");
Value customerNameValue = new Value( "customerName", "customer")
.setDefault("Unknown");
smooks.addVisitors(customerNumberValue);
smooks.addVisitors(customerNameValue);
And the execution code:
JavaResult result = new JavaResult();
smooks.filterSource(new StreamSource(orderMessageStream), result);
Integer customerNumber = (Integer) result.getBean("customerNumber");
String customerName = (String) result.getBean("customerName");
Bean| Constructor Summary | |
|---|---|
Value(String beanId,
String data)
Create a Value binding configuration. |
|
Value(String beanId,
String data,
Class<?> type)
Create a Value binding configuration. |
|
| Method Summary | |
|---|---|
void |
addVisitors(org.milyn.delivery.VisitorConfigMap visitorMap)
Used by Smooks to retrieve the visitor configuration of this Value Configuration |
Value |
setDecoder(org.milyn.javabean.DataDecoder dataDecoder)
The DataDecoder to be used for decoding
the data value. |
Value |
setDefaultValue(String defaultValue)
The default value for if the data is null or empty |
Value |
setTargetNamespace(String targetNamespace)
The namespace for the data selector for the data value to be bound. |
Value |
setType(Class<?> type)
Set the binding value data type. |
| Methods inherited from class org.milyn.javabean.BindingAppender |
|---|
getBeanId |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Value(String beanId,
String data)
beanId - The bean id under which the value will be stored.data - The data selector for the data value to be bound.
public Value(String beanId,
String data,
Class<?> type)
beanId - The bean id under which the value will be stored.data - The data selector for the data value to be bound.type - Data type.| Method Detail |
|---|
public Value setTargetNamespace(String targetNamespace)
targetNamespace - The namespace
this Value configuration instance.public Value setDefaultValue(String defaultValue)
targetNamespace - The default value
this Value configuration instance.public Value setType(Class<?> type)
type - The data type.
this Value configuration instance.public Value setDecoder(org.milyn.javabean.DataDecoder dataDecoder)
DataDecoder to be used for decoding
the data value.
targetNamespace - The DataDecoder
this Value configuration instance.public void addVisitors(org.milyn.delivery.VisitorConfigMap visitorMap)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||