BeanIO 2.0.4

org.beanio.internal.parser
Class UnmarshallerImpl

java.lang.Object
  extended by org.beanio.internal.parser.UnmarshallerImpl
All Implemented Interfaces:
Unmarshaller

public class UnmarshallerImpl
extends Object
implements Unmarshaller

Default Unmarshaller implementation.

Since:
2.0
Author:
Kevin Seim

Constructor Summary
UnmarshallerImpl(UnmarshallingContext context, Selector layout, RecordUnmarshaller recordUnmarshaller)
          Constructs a new UnmarshallerImpl
 
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> list)
          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 text)
          Unmarshals a bean object from the given record text.
 Object unmarshal(String[] array)
          Unmarshals a bean object from the given String[] of fields.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnmarshallerImpl

public UnmarshallerImpl(UnmarshallingContext context,
                        Selector layout,
                        RecordUnmarshaller recordUnmarshaller)
Constructs a new UnmarshallerImpl

Parameters:
context - the UnmarshallingContext
layout - the stream layout
recordUnmarshaller - the RecordUnmarshaller for converting record text to record values
Method Detail

unmarshal

public Object unmarshal(String text)
                 throws MalformedRecordException,
                        UnidentifiedRecordException,
                        UnexpectedRecordException,
                        InvalidRecordException
Description copied from interface: Unmarshaller
Unmarshals a bean object from the given record text. This method is supported by all stream formats.

Specified by:
unmarshal in interface Unmarshaller
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 identified
UnexpectedRecordException - if the record is out of sequence
InvalidRecordException - if the record fails validation

unmarshal

public Object unmarshal(List<String> list)
                 throws BeanReaderException,
                        UnidentifiedRecordException,
                        UnexpectedRecordException,
                        InvalidRecordException
Description copied from interface: Unmarshaller
Unmarshals a bean object from the given List of fields. This method is supported by CSV and delimited formatted streams only.

Specified by:
unmarshal in interface Unmarshaller
Parameters:
list - the List of fields to unmarshal
Returns:
the unmarshalled bean object
Throws:
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 validation

unmarshal

public Object unmarshal(String[] array)
                 throws BeanReaderException,
                        UnidentifiedRecordException,
                        UnexpectedRecordException,
                        InvalidRecordException
Description copied from interface: Unmarshaller
Unmarshals a bean object from the given String[] of fields. This method is supported by CSV and delimited formatted streams only.

Specified by:
unmarshal in interface Unmarshaller
Parameters:
array - the String[] of fields to unmarshal
Returns:
the unmarshalled bean object
Throws:
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 validation

unmarshal

public Object unmarshal(Node node)
                 throws BeanReaderException,
                        UnidentifiedRecordException,
                        UnexpectedRecordException,
                        InvalidRecordException
Description copied from interface: Unmarshaller
Unmarshals a bean object from the given Node. This method is supported by XML formatted streams only.

Specified by:
unmarshal in interface Unmarshaller
Parameters:
node - the Node to unmarshal
Returns:
the unmarshalled bean object
Throws:
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 validation

getRecordName

public String getRecordName()
Description copied from interface: Unmarshaller
Returns the record or group name of the most recent unmarshalled bean object.

Specified by:
getRecordName in interface Unmarshaller
Returns:
the record or group name

getRecordContext

public RecordContext getRecordContext()
Description copied from interface: Unmarshaller
Returns record information for the most recent unmarshalled bean object.

Specified by:
getRecordContext in interface Unmarshaller
Returns:
the unmarshalled RecordContext

BeanIO 2.0.4

Copyright © 2010-2013 Kevin Seim