BeanIO 2.0.4

org.beanio.internal.parser
Class MarshallerImpl

java.lang.Object
  extended by org.beanio.internal.parser.MarshallerImpl
All Implemented Interfaces:
Marshaller

public class MarshallerImpl
extends Object
implements Marshaller

Default Marshaller implementation.

Since:
2.0
Author:
Kevin Seim

Constructor Summary
MarshallerImpl(MarshallingContext context, Selector layout, RecordMarshaller recordMarshaller)
          Constructs a new UnmarshallerImpl
 
Method Summary
protected  Object getRecordValue()
          Returns the record value for the most recent marshalled bean object.
 Marshaller marshal(Object bean)
          Marshals a single bean object.
 Marshaller marshal(String recordName, Object bean)
          Marshals a single bean object.
 String[] toArray()
          Returns the most recent marshalled bean object as a String[] for csv and delimited formatted streams.
 Document toDocument()
          Returns the most recent marshalled bean object as a Document for xml formatted streams.
 List<String> toList()
          Returns the most recent marshalled bean object as a List for csv and delimited formatted streams.
 String toString()
          Returns the most recent marshalled bean object as a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MarshallerImpl

public MarshallerImpl(MarshallingContext context,
                      Selector layout,
                      RecordMarshaller recordMarshaller)
Constructs a new UnmarshallerImpl

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

marshal

public Marshaller marshal(Object bean)
                   throws BeanWriterException
Description copied from interface: Marshaller
Marshals a single bean object.

Specified by:
marshal in interface Marshaller
Parameters:
bean - the bean object to marshal
Returns:
this Marshaller
Throws:
BeanWriterException - if a record is not matched for the given bean object, or in some other rare (but fatal) conditions

marshal

public Marshaller marshal(String recordName,
                          Object bean)
                   throws BeanWriterException
Description copied from interface: Marshaller
Marshals a single bean object.

Specified by:
marshal in interface Marshaller
Parameters:
recordName - the name of the record to marshal
bean - the bean object to marshal
Returns:
this Marshaller
Throws:
BeanWriterException - if a record is not matched for the given record name and bean object, or in some other rare (but fatal) conditions

toString

public String toString()
Description copied from interface: Marshaller
Returns the most recent marshalled bean object as a String. This method is supported by all stream formats.

Specified by:
toString in interface Marshaller
Overrides:
toString in class Object
Returns:
the record text

toArray

public String[] toArray()
                 throws BeanWriterException
Description copied from interface: Marshaller
Returns the most recent marshalled bean object as a String[] for csv and delimited formatted streams.

Specified by:
toArray in interface Marshaller
Returns:
the String array of fields
Throws:
BeanWriterException - if an array is not supported by the stream format

toList

public List<String> toList()
                    throws BeanWriterException
Description copied from interface: Marshaller
Returns the most recent marshalled bean object as a List for csv and delimited formatted streams.

Specified by:
toList in interface Marshaller
Returns:
the List of fields
Throws:
BeanWriterException - if an array is not supported by the stream format

toDocument

public Document toDocument()
                    throws BeanWriterException
Description copied from interface: Marshaller
Returns the most recent marshalled bean object as a Document for xml formatted streams.

Specified by:
toDocument in interface Marshaller
Returns:
the Document
Throws:
BeanWriterException - if Document is not supported by the stream format

getRecordValue

protected Object getRecordValue()
Returns the record value for the most recent marshalled bean object.

Returns:
the record value

BeanIO 2.0.4

Copyright © 2010-2013 Kevin Seim