|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ParseListener
Parse listener interface.
Provides the API between the Source and the application performing batched parsing. The implementation of this interface will be notified of the following events as they occur during the parsing of a batched complex data type:onBatchEntryParsed(Object)
returns an Object which will be attached to it's parent Complex Data Object (i.e. the batch).
In general this returned value will be the argument to the method. Prior to returning from this method, the object argument
can be altered or replaced or a null value may be returned which will prevent the Source from adding the value to the batch.
When processing large files or long streams it can be useful to return null and instead process the batch entry from within the onBatchEntryParsed(Object)
method. This allows for abitrary size files / streams to be read.
Whenever parsing of any batch entry fails, the client application will have the approximately reconstructed partially
parsed Complex Data Object. The reconstruction process attempts to construct the object as close as possible to the
expected value. If any part of batch entry couldn't be instantiated then a new element will be constructed with the data
that can't be parsed. The name of new element can be specified by client application via the generate name callback
.
Method Summary | |
---|---|
String |
generateFailedName(String original)
New element name generator. |
boolean |
isAdditionalBatch(Element element)
Returns whether the specified element should be considered a batch during this parse operation. |
void |
onBatchEntryFailed(Object object,
ParserException failure)
Called on failure to parse a batch entry. |
Object |
onBatchEntryParsed(Object object)
Called on successful parsing of a batch entry. |
void |
onEndBatch(Element element)
End batch parsing callback. |
void |
onStartBatch(Element element)
Start of batch parsing callback. |
Method Detail |
---|
void onStartBatch(Element element) throws ParserException
Complex Data Type
marked as
batch
is found in the data stream.
element
- the element
that will be parsed as a batch.
ParserException
- if parsing should be stopped.void onEndBatch(Element element) throws ParserException
Complex Data Type
marked as
batch
been found in the data stream.
element
- the element
that was parsed as a batch.
ParserException
- if parsing should be stopped.Object onBatchEntryParsed(Object object) throws ParserException
null
value can be returned. This will prevent the collection of
all data in memory and allow each batch entry to be garbage collected before the return of the Source.readObject(biz.c24.io.api.data.Element)
method.
object
- the batch entry that was parsed.
ParserException
- if parsing should be stopped.void onBatchEntryFailed(Object object, ParserException failure) throws ParserException
object
- the batch entry instance that was reconstructed.failure
- the parser exception
that contains list of all
parser error reason
that caused that failure.
ParserException
- if parsing should be stopped.String generateFailedName(String original)
original
- the original name of element that was failed to parse.
boolean isAdditionalBatch(Element element)
false
and allow the C24 Integration Objects API to defer to the model instead.
element
- The element in question.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |