|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface DataDecoder
Data decoder.
A data decoder converts data (encoded in a String) to an Object of some form, determined by the decoder implementation. There are a number of pre-installed decoders in theorg.milyn.javabean.decoders
package. Smooks will attempt to automatically load a data type decoder from the
org.milyn.javabean.decoders package, but only after it has attempted to load
the decoder from the context configuration,
using a selector key of "decoder:type", where "type" is the type alias used on the
property binding configuration (see the "OrderDateLong" definition in the sample
in org.milyn.javabean.BeanPopulator in the Javabeans Cartridge.
If one of the decoders in org.milyn.javabean.decoders is not what's needed, simply
implement a new decoder using this interface. If you want the decoder to be automatically
picked up from the type alias specified on the binding configuration (e.g in the same way
as the decoders for types "Long", "Integer" etc are picked up) simply package the new decoder
in the org.milyn.javabean.decoders package and follow the class naming convention of
"typeDecoder".
Some type decoders will however need to be configured as a Smooks resource
because they will require configuration of one sort or another. For an example of this,
look at the "OrderDateLong" decoder definition in the sample
in org.milyn.javabean.BeanPopulator in the Javabeans Cartridge.
| Nested Class Summary | |
|---|---|
static class |
DataDecoder.Factory
Factory method for constructing decoders defined in the "decoders" package. |
| Method Summary | |
|---|---|
Object |
decode(String data)
Decode the supplied String data into a new Object data instance. |
| Method Detail |
|---|
Object decode(String data)
throws DataDecodeException
data - Data to be decoded.
DataDecodeException - Error decoding data.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||