T
- The type of EntryTO
extension that the processor will work with.public abstract class EntryProcessor<T extends EntryTO<?>> extends Object
EntryTO
.ItemTO
and ListTO
extends EntryTO
soItemProcessor
and ListProcessor
are concrete implementations of this class.Modifier and Type | Field and Description |
---|---|
protected T |
entry
EntryTO that the subclass will work with.
This object is initialised when the getInstance(EntryTO) is called. |
Modifier | Constructor and Description |
---|---|
protected |
EntryProcessor(T entry)
Initialises the entry object.
|
Modifier and Type | Method and Description |
---|---|
abstract String |
format(Object field)
Format's the object into positional data following the processor
entry properties. |
static EntryProcessor<?> |
getInstance(EntryTO<?> entry)
Instantiation method that resolves which type of concrete processor should be retrieved.
If the entry passed to the method is a instanceof ItemTO then a ItemProcessor should be retrieved, otherwise a ListProcessor is returned. |
abstract Object |
parse(String data)
Parse's the positional data into a java.lang.Object following the processor
entry properties. |
protected final T extends EntryTO<?> entry
getInstance(EntryTO)
is called.protected EntryProcessor(T entry)
entry
- Object that the processor will use to parse or format data.public static EntryProcessor<?> getInstance(EntryTO<?> entry) throws LayoutException
ItemTO
then a ItemProcessor
ListProcessor
is returned.entry
- The entry that the concrete processor will work with.LayoutException
- Please refer to ListProcessor.ListProcessor(ListTO)
public abstract Object parse(String data) throws MalformedInputException
entry
properties.data
- Textual raw data to be parsed.EntryTO.getType()
.MalformedInputException
- In case there's a problem parsing the data.public abstract String format(Object field) throws MalformedOutputException
entry
properties.field
- The object that should be parsedMalformedOutputException
- In case there's a problem formating the field into a positional data stringCopyright © 2014. All Rights Reserved.