public class MarshallerImpl extends Object implements Marshaller
Marshaller
implementation.Constructor and Description |
---|
MarshallerImpl(MarshallingContext context,
Selector layout,
RecordMarshaller recordMarshaller)
Constructs a new UnmarshallerImpl
|
Modifier and Type | Method and Description |
---|---|
void |
debug()
Prints the internal view of the stream configuration
to
System.out |
void |
debug(PrintStream out)
Prints the internal view of the stream configuration.
|
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.
|
public MarshallerImpl(MarshallingContext context, Selector layout, RecordMarshaller recordMarshaller)
context
- the UnmarshallingContext
layout
- the stream layoutrecordMarshaller
- the RecordMarshaller
for converting record text to record valuespublic Marshaller marshal(Object bean) throws BeanWriterException
Marshaller
marshal
in interface Marshaller
bean
- the bean object to marshalBeanWriterException
- if a record is not matched for the given bean object,
or in some other rare (but fatal) conditionspublic Marshaller marshal(String recordName, Object bean) throws BeanWriterException
Marshaller
marshal
in interface Marshaller
recordName
- the name of the record to marshalbean
- the bean object to marshalBeanWriterException
- if a record is not matched for the given record name
and bean object, or in some other rare (but fatal) conditionspublic String toString()
Marshaller
toString
in interface Marshaller
toString
in class Object
public String[] toArray() throws BeanWriterException
Marshaller
toArray
in interface Marshaller
BeanWriterException
- if an array is not supported by the stream formatpublic List<String> toList() throws BeanWriterException
Marshaller
List
for csv
and delimited formatted streams.toList
in interface Marshaller
List
of fieldsBeanWriterException
- if an array is not supported by the stream formatpublic Document toDocument() throws BeanWriterException
Marshaller
Document
for xml
formatted streams.toDocument
in interface Marshaller
Document
BeanWriterException
- if Document
is not supported by the stream formatprotected Object getRecordValue()
public void debug()
Debuggable
System.out
debug
in interface Debuggable
public void debug(PrintStream out)
Debuggable
debug
in interface Debuggable
out
- the PrintStream
to write to