BeanIO 2.0.4

org.beanio.internal.parser.format.xml
Class XmlWrapper

java.lang.Object
  extended by org.beanio.internal.util.TreeNode<Component>
      extended by org.beanio.internal.parser.Component
          extended by org.beanio.internal.parser.ParserComponent
              extended by org.beanio.internal.parser.DelegatingParser
                  extended by org.beanio.internal.parser.format.xml.XmlWrapper
All Implemented Interfaces:
Cloneable, Iterable<Component>, XmlNode, Parser, Replicateable

public class XmlWrapper
extends DelegatingParser
implements XmlNode

Since:
2.0
Author:
Kevin Seim

Field Summary
 
Fields inherited from interface org.beanio.internal.parser.format.xml.XmlNode
XML_TYPE_ATTRIBUTE, XML_TYPE_ELEMENT, XML_TYPE_NONE, XML_TYPE_TEXT
 
Constructor Summary
XmlWrapper()
          Constructs a new XmlWrapper.
 
Method Summary
 String getLocalName()
          Returns the XML local name for this node.
 String getNamespace()
          Returns the namespace of this node.
 String getPrefix()
          Returns the namespace prefix for marshaling this node, or null if the namespace should override the default namespace.
 int getType()
          Returns the XML node type.
 boolean isLazy()
          Returns whether this node must exist during unmarshalling.
 boolean isNamespaceAware()
          Returns true if a namespace was configured for this node, and is therefore used to unmarshal and marshal the node.
 boolean isNillable()
          Returns whether this node is nillable.
 boolean isRepeating()
          Returns whether this node may repeat in the context of its immediate parent.
 boolean marshal(MarshallingContext context)
          Marshals a record.
 boolean matches(UnmarshallingContext context)
          Returns whether this parser and its children match a record being unmarshalled.
 void setLazy(boolean lazy)
           
 void setLocalName(String localName)
           
 void setNamespace(String namespace)
           
 void setNamespaceAware(boolean namespaceAware)
           
 void setNillable(boolean nillable)
           
 void setPrefix(String prefix)
           
 void setRepeating(boolean repeating)
           
protected  void toParamString(StringBuilder s)
          Called by TreeNode.toString() to append node parameters to the output.
 boolean unmarshal(UnmarshallingContext context)
          Unmarshals a record.
 
Methods inherited from class org.beanio.internal.parser.DelegatingParser
clearValue, getParser, getSize, getValue, hasContent, isIdentifier, setValue
 
Methods inherited from class org.beanio.internal.parser.ParserComponent
isSupportedChild
 
Methods inherited from class org.beanio.internal.parser.Component
registerLocals
 
Methods inherited from class org.beanio.internal.util.TreeNode
add, clone, find, getChildren, getFirst, getName, iterator, print, setName, size, sort, toString, updateReferences
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.beanio.internal.parser.Parser
getName
 

Constructor Detail

XmlWrapper

public XmlWrapper()
Constructs a new XmlWrapper.

Method Detail

matches

public boolean matches(UnmarshallingContext context)
Description copied from interface: Parser
Returns whether this parser and its children match a record being unmarshalled.

Specified by:
matches in interface Parser
Overrides:
matches in class DelegatingParser
Parameters:
context - the UnmarshallingContext
Returns:
true if matched, false otherwise

unmarshal

public boolean unmarshal(UnmarshallingContext context)
Description copied from interface: Parser
Unmarshals a record.

Specified by:
unmarshal in interface Parser
Overrides:
unmarshal in class DelegatingParser
Parameters:
context - the UnmarshallingContext
Returns:
true if this component was present in the unmarshalled record, or false otherwise

marshal

public boolean marshal(MarshallingContext context)
                throws IOException
Description copied from interface: Parser
Marshals a record.

Specified by:
marshal in interface Parser
Overrides:
marshal in class DelegatingParser
Parameters:
context - the MarshallingContext
Returns:
whether a value was marshalled
Throws:
IOException - if an I/O error occurs

getLocalName

public String getLocalName()
Description copied from interface: XmlNode
Returns the XML local name for this node.

Specified by:
getLocalName in interface XmlNode
Returns:
the XML local name

setLocalName

public void setLocalName(String localName)

getPrefix

public String getPrefix()
Description copied from interface: XmlNode
Returns the namespace prefix for marshaling this node, or null if the namespace should override the default namespace.

Specified by:
getPrefix in interface XmlNode
Returns:
the namespace prefix

setPrefix

public void setPrefix(String prefix)

getNamespace

public String getNamespace()
Description copied from interface: XmlNode
Returns the namespace of this node. If there is no namespace for this node, or this node is not namespace aware, null is returned.

Specified by:
getNamespace in interface XmlNode
Returns:
the XML namespace of this node

setNamespace

public void setNamespace(String namespace)

isNamespaceAware

public boolean isNamespaceAware()
Description copied from interface: XmlNode
Returns true if a namespace was configured for this node, and is therefore used to unmarshal and marshal the node.

Specified by:
isNamespaceAware in interface XmlNode
Returns:
true if this node uses a namespace for matching and formatting this node

setNamespaceAware

public void setNamespaceAware(boolean namespaceAware)

isNillable

public boolean isNillable()
Description copied from interface: XmlNode
Returns whether this node is nillable.

Specified by:
isNillable in interface XmlNode
Returns:
true if this node is nillable

setNillable

public void setNillable(boolean nillable)

getType

public int getType()
Description copied from interface: XmlNode
Returns the XML node type.

Specified by:
getType in interface XmlNode
Returns:
one of XmlNode.XML_TYPE_NONE, XmlNode.XML_TYPE_ELEMENT, XmlNode.XML_TYPE_ATTRIBUTE, or XmlNode.XML_TYPE_TEXT

isRepeating

public boolean isRepeating()
Description copied from interface: XmlNode
Returns whether this node may repeat in the context of its immediate parent.

Specified by:
isRepeating in interface XmlNode
Returns:
true if this node repeats, false otherwise

setRepeating

public void setRepeating(boolean repeating)

isLazy

public boolean isLazy()
Description copied from interface: Parser
Returns whether this node must exist during unmarshalling.

Specified by:
isLazy in interface Parser
Overrides:
isLazy in class DelegatingParser
Returns:
true if this node is optional during unmarshalling, false otherwise

setLazy

public void setLazy(boolean lazy)

toParamString

protected void toParamString(StringBuilder s)
Description copied from class: TreeNode
Called by TreeNode.toString() to append node parameters to the output.

Overrides:
toParamString in class TreeNode<Component>
Parameters:
s - the output to append

BeanIO 2.0.4

Copyright © 2010-2013 Kevin Seim