Package org.beanio.internal.parser
Class UnmarshallerImpl
- java.lang.Object
-
- org.beanio.internal.parser.UnmarshallerImpl
-
- All Implemented Interfaces:
Debuggable,Unmarshaller
public class UnmarshallerImpl extends java.lang.Object implements Unmarshaller
DefaultUnmarshallerimplementation.- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description UnmarshallerImpl(UnmarshallingContext context, Selector layout, RecordUnmarshaller recordUnmarshaller)Constructs a newUnmarshallerImpl
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddebug()Prints the internal view of the stream configuration toSystem.outvoiddebug(java.io.PrintStream out)Prints the internal view of the stream configuration.RecordContextgetRecordContext()Returns record information for the most recent unmarshalled bean object.java.lang.StringgetRecordName()Returns the record or group name of the most recent unmarshalled bean object.java.lang.Objectunmarshal(java.lang.String text)Unmarshals a bean object from the given record text.java.lang.Objectunmarshal(java.lang.String[] array)Unmarshals a bean object from the givenString[]of fields.java.lang.Objectunmarshal(java.util.List<java.lang.String> list)Unmarshals a bean object from the givenListof fields.java.lang.Objectunmarshal(org.w3c.dom.Node node)Unmarshals a bean object from the givenNode.
-
-
-
Constructor Detail
-
UnmarshallerImpl
public UnmarshallerImpl(UnmarshallingContext context, Selector layout, RecordUnmarshaller recordUnmarshaller)
Constructs a newUnmarshallerImpl- Parameters:
context- theUnmarshallingContextlayout- the stream layoutrecordUnmarshaller- theRecordUnmarshallerfor converting record text to record values
-
-
Method Detail
-
unmarshal
public java.lang.Object unmarshal(java.lang.String text) throws MalformedRecordException, UnidentifiedRecordException, UnexpectedRecordException, InvalidRecordExceptionDescription copied from interface:UnmarshallerUnmarshals a bean object from the given record text. This method is supported by all stream formats.- Specified by:
unmarshalin interfaceUnmarshaller- Parameters:
text- the record text to unmarhal- Returns:
- the unmarshalled bean object
- Throws:
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 identifiedUnexpectedRecordException- if the record is out of sequenceInvalidRecordException- if the record fails validation
-
unmarshal
public java.lang.Object unmarshal(java.util.List<java.lang.String> list) throws BeanReaderException, UnidentifiedRecordException, UnexpectedRecordException, InvalidRecordExceptionDescription copied from interface:UnmarshallerUnmarshals a bean object from the givenListof fields. This method is supported by CSV and delimited formatted streams only.- Specified by:
unmarshalin interfaceUnmarshaller- Parameters:
list- theListof fields to unmarshal- Returns:
- the unmarshalled bean object
- Throws:
BeanReaderException- if aListis not supported by the stream format, or if the bean is bound to a record group, or if some other rare (but fatal) error occursUnidentifiedRecordException- if the record type could not be identifiedUnexpectedRecordException- if the record is out of sequenceInvalidRecordException- if the record fails validation
-
unmarshal
public java.lang.Object unmarshal(java.lang.String[] array) throws BeanReaderException, UnidentifiedRecordException, UnexpectedRecordException, InvalidRecordExceptionDescription copied from interface:UnmarshallerUnmarshals a bean object from the givenString[]of fields. This method is supported by CSV and delimited formatted streams only.- Specified by:
unmarshalin interfaceUnmarshaller- Parameters:
array- theString[]of fields to unmarshal- Returns:
- the unmarshalled bean object
- Throws:
BeanReaderException- if aString[]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 occursUnidentifiedRecordException- if the record type could not be identifiedUnexpectedRecordException- if the record is out of sequenceInvalidRecordException- if the record fails validation
-
unmarshal
public java.lang.Object unmarshal(org.w3c.dom.Node node) throws BeanReaderException, UnidentifiedRecordException, UnexpectedRecordException, InvalidRecordExceptionDescription copied from interface:UnmarshallerUnmarshals a bean object from the givenNode. This method is supported by XML formatted streams only.- Specified by:
unmarshalin interfaceUnmarshaller- Parameters:
node- theNodeto unmarshal- Returns:
- the unmarshalled bean object
- Throws:
BeanReaderException- if aNodeis not supported by the stream format, or if the bean is bound to a record group, or if some other rare (but fatal) error occursUnidentifiedRecordException- if the record type could not be identifiedUnexpectedRecordException- if the record is out of sequenceInvalidRecordException- if the record fails validation
-
getRecordName
public java.lang.String getRecordName()
Description copied from interface:UnmarshallerReturns the record or group name of the most recent unmarshalled bean object.- Specified by:
getRecordNamein interfaceUnmarshaller- Returns:
- the record or group name
-
getRecordContext
public RecordContext getRecordContext()
Description copied from interface:UnmarshallerReturns record information for the most recent unmarshalled bean object.- Specified by:
getRecordContextin interfaceUnmarshaller- Returns:
- the unmarshalled
RecordContext
-
debug
public void debug()
Description copied from interface:DebuggablePrints the internal view of the stream configuration toSystem.out- Specified by:
debugin interfaceDebuggable
-
debug
public void debug(java.io.PrintStream out)
Description copied from interface:DebuggablePrints the internal view of the stream configuration.- Specified by:
debugin interfaceDebuggable- Parameters:
out- thePrintStreamto write to
-
-