org.milyn.javabean
Interface DataDecoder

All Superinterfaces:
Serializable
All Known Subinterfaces:
DataEncoder
All Known Implementing Classes:
BigDecimalDecoder, BigIntegerDecoder, BinaryDecoder, BooleanDecoder, ByteDecoder, CalendarDecoder, CharacterDecoder, CharsetDecoder, ClassDecoder, CSVDecoder, CustomDecoder, DateDecoder, DoubleDecoder, EnumDecoder, FileDecoder, FloatDecoder, IntegerDecoder, LocaleAwareDateDecoder, LocaleAwareDecoder, LongDecoder, MappingDecoder, NumberDecoder, ShortDecoder, SqlDateDecoder, SqlTimeDecoder, SqlTimestampDecoder, StringDecoder, URIDecoder, URLDecoder, XMLGregorianCalendarDecoder

public interface DataDecoder
extends Serializable

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 the org.milyn.javabean.decoders package. DataDecoders are used in a numkber of places in Smooks:

Smooks can automatically select an appropriate DataDecoder for a given purpose (via the DataDecoder.Factory factory class) if the decoder is:
  1. Annotated with the DecodeType annotation.
  2. Specified in the "/META-INF/data-decoders.inf" file on the classpath. Obviously this file can exist on any number of classpath URIs. If defining custom decoders, just add the "/META-INF/data-decoders.inf" file to your .jar file (or somewhere on the classpath). Smooks will find all such files on the classpath.
Note how all the decoders in this package follow a well defined naming pattern of "typeDecoder", where type is the Java datatype to which the implementation decodes.

Author:
tom.fennelly@gmail.com
See Also:
DataEncoder

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

decode

Object decode(String data)
              throws DataDecodeException
Decode the supplied String data into a new Object data instance.

Parameters:
data - Data to be decoded.
Returns:
Decoded data Object.
Throws:
DataDecodeException - Error decoding data.


Copyright © 2018. All rights reserved.