|
BeanIO 2.0.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.beanio.internal.parser.ParsingContext org.beanio.internal.parser.MarshallingContext
public abstract class MarshallingContext
Stores context information needed to marshal a bean object.
Subclasses must implement getRecordObject()
which is invoked
when writeRecord()
is called to write a record object to the
configured RecordWriter
.
Field Summary |
---|
Fields inherited from class org.beanio.internal.parser.ParsingContext |
---|
MARSHALLING, UNMARSHALLING |
Constructor Summary | |
---|---|
MarshallingContext()
Constructs a new MarshallingContext. |
Method Summary | |
---|---|
void |
clear()
Clear is invoked after each record is marshalled. |
Object |
getBean()
Returns the bean object to marshal. |
String |
getComponentName()
Returns the component name of the record or group to marshal. |
char |
getMode()
Returns the parsing mode. |
protected abstract Object |
getRecordObject()
Returns the record object to pass to the RecordWriter when
writeRecord() is called. |
RecordWriter |
getRecordWriter()
Returns the RecordWriter to write to. |
void |
setBean(Object bean)
Sets the bean object to marshal. |
void |
setComponentName(String componentName)
Sets the component name of the record or group to marshal. |
void |
setRecordWriter(RecordWriter recordWriter)
Set the RecordWriter to write to. |
String[] |
toArray(Object record)
Converts a record object to a String[]. |
Document |
toDocument(Object record)
Converts a record object to a Document . |
List<String> |
toList(Object record)
Converts a record object to a List . |
void |
writeRecord()
Writes the current record object to the record writer. |
Methods inherited from class org.beanio.internal.parser.ParsingContext |
---|
createHeap, getAdjustedFieldPosition, getLocal, getRelativeFieldIndex, isRepeating, popIteration, pushIteration, setLocal |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MarshallingContext()
Method Detail |
---|
public final char getMode()
ParsingContext
getMode
in class ParsingContext
ParsingContext.UNMARSHALLING
or ParsingContext.MARSHALLING
public void clear()
public void writeRecord() throws IOException
getRecordObject()
method.
IOException
- if an I/O error occursprotected abstract Object getRecordObject()
RecordWriter
when
writeRecord()
is called.
public String[] toArray(Object record)
record
- the record object to convert
public List<String> toList(Object record)
List
.
record
- the record object to convert
List
result, or null if not supportedpublic Document toDocument(Object record)
Document
.
record
- the record object to convert
Document
result, or null if not supportedpublic String getComponentName()
public void setComponentName(String componentName)
componentName
- the component name to marshalpublic Object getBean()
public void setBean(Object bean)
bean
- the bean objectpublic RecordWriter getRecordWriter()
RecordWriter
to write to.
RecordWriter
public void setRecordWriter(RecordWriter recordWriter)
RecordWriter
to write to.
recordWriter
- the RecordWriter
|
BeanIO 2.0.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |