|
BeanIO 1.2.3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.beanio.parser.xml.Marshaller
public abstract class Marshaller
Base class for XML group and record node marshallers.
A Marshaller instance implements a linked list of child marshallers and holds a reference to a parent marshaller to form a tree that defines the structure of the XML document being marshalled.
Field Summary | |
---|---|
protected int |
count
|
Constructor Summary | |
---|---|
Marshaller(Marshaller parent,
NodeDefinition definition)
Constructs a new Marshaller. |
Method Summary | |
---|---|
void |
addChild(Marshaller child)
Adds a child to this marshaler. |
abstract Node |
createHierarchy(Document document)
Recursively creates the XML hierarchy of group nodes. |
int |
getCount()
Returns the number of times this node has been marshaled. |
Marshaller |
getFirstChild()
Returns the first child of this marshaler, or null if this marshaler does not have any children. |
protected String |
getKey(String namespace,
String name)
Returns a Map key for accessing state information for this Node. |
Marshaller |
getNextSibling()
Returns the next sibling to this marshaler, or null if none exists. |
NodeDefinition |
getNodeDefinition()
Returns the node definition wrapped by this marshaler. |
Marshaller |
getParent()
Returns this marshaler's parent marshaler. |
boolean |
isMaxOccursReached()
Returns whether the marshal count of this node has reached the configured maximum occurrences. |
void |
removeAllChildren()
Removes all children of this marshaler. |
abstract void |
reset()
Resets the occurrences of this node and/or its children. |
void |
restoreState(String namespace,
Map<String,Object> state)
Restores a Map of previously stored state information. |
void |
updateState(String namespace,
Map<String,Object> state)
Updates a Map with the current state of the Marshaller. |
abstract boolean |
write(RecordWriter out,
String recordName,
Object bean)
Marshals this node to a RecordWriter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int count
Constructor Detail |
---|
public Marshaller(Marshaller parent, NodeDefinition definition)
parent
- the parent Marshaller nodedefinition
- the node definition marshaled by this marshalerMethod Detail |
---|
public NodeDefinition getNodeDefinition()
public int getCount()
public boolean isMaxOccursReached()
public abstract void reset()
public abstract Node createHierarchy(Document document)
document
- the document object model to append
public abstract boolean write(RecordWriter out, String recordName, Object bean) throws IOException
out
- the RecordWriter to write torecordName
- the name of the record to marshal (may be null if unknown)bean
- the record bean to marshal
IOException
- if an I/O error is thrown by the RecordWriterpublic Marshaller getParent()
public void addChild(Marshaller child)
child
- the child Marshaller to addpublic Marshaller getFirstChild()
public Marshaller getNextSibling()
public void removeAllChildren()
public void updateState(String namespace, Map<String,Object> state)
namespace
- a String to prefix all state keys withstate
- the Map to update with the latest statepublic void restoreState(String namespace, Map<String,Object> state)
namespace
- a String to prefix all state keys withstate
- the Map containing the state to restoreprotected String getKey(String namespace, String name)
namespace
- the assigned namespace for the keyname
- the state information to access
|
BeanIO 1.2.3 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |