|
BeanIO 2.0.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Unmarshaller
Interface for unmarshalling single records.
An Unmarshaller can be used to unmarshal a bean object bound to
a record in a mapping file. Unmarshalling bean objects that span multiple
records is not supported and will cause a BeanReaderException
.
An Unmarshaller instance is stateful. If a BeanIO mapping file declares
record ordering and expected occurrences, a BeanWriterException
may be thrown for
records read out of sequence or that have exceeded their maximum occurrences.
There is some performance benefit for reusing the same Unmarshaller instance, but an Unmarshaller is not thread safe and should not be used to unmarshal multiple records concurrently.
Method Summary | |
---|---|
RecordContext |
getRecordContext()
Returns record information for the most recent unmarshalled bean object. |
String |
getRecordName()
Returns the record or group name of the most recent unmarshalled bean object. |
Object |
unmarshal(List<String> fields)
Unmarshals a bean object from the given List of fields. |
Object |
unmarshal(Node node)
Unmarshals a bean object from the given Node . |
Object |
unmarshal(String record)
Unmarshals a bean object from the given record text. |
Object |
unmarshal(String[] fields)
Unmarshals a bean object from the given String[] of fields. |
Method Detail |
---|
Object unmarshal(String record) throws BeanReaderException, MalformedRecordException, UnidentifiedRecordException, UnexpectedRecordException, InvalidRecordException
record
- the record text to unmarhal
BeanReaderException
- if the bean is bound to a record group, or some other
rare (but fatal) error occurs
MalformedRecordException
- if the record text could not be parsed (due to the
expected syntax of the stream format)
UnidentifiedRecordException
- if the record type could not be identified
UnexpectedRecordException
- if the record is out of sequence
InvalidRecordException
- if the record fails validationObject unmarshal(List<String> fields) throws BeanReaderException, UnidentifiedRecordException, UnexpectedRecordException, InvalidRecordException
List
of fields. This method is supported by
CSV and delimited formatted streams only.
fields
- the List
of fields to unmarshal
BeanReaderException
- if a List
is not supported by the stream format,
or if the bean is bound to a record group, or if some other rare (but fatal) error occurs
UnidentifiedRecordException
- if the record type could not be identified
UnexpectedRecordException
- if the record is out of sequence
InvalidRecordException
- if the record fails validationObject unmarshal(String[] fields) throws BeanReaderException, UnidentifiedRecordException, UnexpectedRecordException, InvalidRecordException
fields
- the String[] of fields to unmarshal
BeanReaderException
- if a String[] is not supported by the stream format,
or if the bean is bound to a record group, or if some other rare (but fatal) error occurs
UnidentifiedRecordException
- if the record type could not be identified
UnexpectedRecordException
- if the record is out of sequence
InvalidRecordException
- if the record fails validationObject unmarshal(Node node) throws BeanReaderException, UnidentifiedRecordException, UnexpectedRecordException, InvalidRecordException
Node
. This method is supported by
XML formatted streams only.
node
- the Node
to unmarshal
BeanReaderException
- if a Node
is not supported by the stream format,
or if the bean is bound to a record group, or if some other rare (but fatal) error occurs
UnidentifiedRecordException
- if the record type could not be identified
UnexpectedRecordException
- if the record is out of sequence
InvalidRecordException
- if the record fails validationString getRecordName()
RecordContext getRecordContext()
RecordContext
|
BeanIO 2.0.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |