Class XmlWrapper
- java.lang.Object
-
- org.beanio.internal.util.TreeNode<Component>
-
- org.beanio.internal.parser.Component
-
- org.beanio.internal.parser.ParserComponent
-
- org.beanio.internal.parser.DelegatingParser
-
- org.beanio.internal.parser.format.xml.XmlWrapper
-
- All Implemented Interfaces:
java.lang.Cloneable,java.lang.Iterable<Component>,XmlNode,Parser,Replicateable
public class XmlWrapper extends DelegatingParser implements XmlNode
- Since:
- 2.0
-
-
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
Constructors Constructor Description XmlWrapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetLocalName()Returns the XML local name for this node.java.lang.StringgetNamespace()Returns the namespace of this node.java.lang.StringgetPrefix()Returns the namespace prefix for marshaling this node, ornullif the namespace should override the default namespace.intgetType()Returns the XML node type.booleanisNamespaceAware()Returnstrueif a namespace was configured for this node, and is therefore used to unmarshal and marshal the node.booleanisNillable()Returns whether this node is nillable.booleanisOptional()Returns whether this node must exist during unmarshalling.booleanisRepeating()Returns whether this node may repeat in the context of its immediate parent.booleanmarshal(MarshallingContext context)Marshals a record.booleanmatches(UnmarshallingContext context)Returns whether this parser and its children match a record being unmarshalled.voidsetLazy(boolean lazy)voidsetLocalName(java.lang.String localName)voidsetNamespace(java.lang.String namespace)voidsetNamespaceAware(boolean namespaceAware)voidsetNillable(boolean nillable)voidsetPrefix(java.lang.String prefix)voidsetRepeating(boolean repeating)protected voidtoParamString(java.lang.StringBuilder s)Called byTreeNode.toString()to append node parameters to the output.booleanunmarshal(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, isDescendant, iterator, print, print, setName, size, sort, toString, updateReferences
-
-
-
-
Method Detail
-
matches
public boolean matches(UnmarshallingContext context)
Description copied from interface:ParserReturns whether this parser and its children match a record being unmarshalled.- Specified by:
matchesin interfaceParser- Overrides:
matchesin classDelegatingParser- Parameters:
context- theUnmarshallingContext- Returns:
- true if matched, false otherwise
-
unmarshal
public boolean unmarshal(UnmarshallingContext context)
Description copied from interface:ParserUnmarshals a record.- Specified by:
unmarshalin interfaceParser- Overrides:
unmarshalin classDelegatingParser- Parameters:
context- theUnmarshallingContext- Returns:
trueif this component was present in the unmarshalled record, orfalseotherwise
-
marshal
public boolean marshal(MarshallingContext context) throws java.io.IOException
Description copied from interface:ParserMarshals a record.- Specified by:
marshalin interfaceParser- Overrides:
marshalin classDelegatingParser- Parameters:
context- theMarshallingContext- Returns:
- whether a value was marshalled
- Throws:
java.io.IOException- if an I/O error occurs
-
getLocalName
public java.lang.String getLocalName()
Description copied from interface:XmlNodeReturns the XML local name for this node.- Specified by:
getLocalNamein interfaceXmlNode- Returns:
- the XML local name
-
setLocalName
public void setLocalName(java.lang.String localName)
-
getPrefix
public java.lang.String getPrefix()
Description copied from interface:XmlNodeReturns the namespace prefix for marshaling this node, ornullif the namespace should override the default namespace.
-
setPrefix
public void setPrefix(java.lang.String prefix)
-
getNamespace
public java.lang.String getNamespace()
Description copied from interface:XmlNodeReturns the namespace of this node. If there is no namespace for this node, or this node is not namespace aware,nullis returned.- Specified by:
getNamespacein interfaceXmlNode- Returns:
- the XML namespace of this node
-
setNamespace
public void setNamespace(java.lang.String namespace)
-
isNamespaceAware
public boolean isNamespaceAware()
Description copied from interface:XmlNodeReturnstrueif a namespace was configured for this node, and is therefore used to unmarshal and marshal the node.- Specified by:
isNamespaceAwarein interfaceXmlNode- Returns:
trueif 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:XmlNodeReturns whether this node is nillable.- Specified by:
isNillablein interfaceXmlNode- Returns:
trueif this node is nillable
-
setNillable
public void setNillable(boolean nillable)
-
getType
public int getType()
Description copied from interface:XmlNodeReturns the XML node type.- Specified by:
getTypein interfaceXmlNode- Returns:
- one of
XmlNode.XML_TYPE_NONE,XmlNode.XML_TYPE_ELEMENT,XmlNode.XML_TYPE_ATTRIBUTE, orXmlNode.XML_TYPE_TEXT
-
isRepeating
public boolean isRepeating()
Description copied from interface:XmlNodeReturns whether this node may repeat in the context of its immediate parent.- Specified by:
isRepeatingin interfaceXmlNode- Returns:
- true if this node repeats, false otherwise
-
setRepeating
public void setRepeating(boolean repeating)
-
isOptional
public boolean isOptional()
Description copied from interface:ParserReturns whether this node must exist during unmarshalling.- Specified by:
isOptionalin interfaceParser- Overrides:
isOptionalin classDelegatingParser- Returns:
- true if this node is optional during unmarshalling, false otherwise
-
setLazy
public void setLazy(boolean lazy)
-
toParamString
protected void toParamString(java.lang.StringBuilder s)
Description copied from class:TreeNodeCalled byTreeNode.toString()to append node parameters to the output.- Overrides:
toParamStringin classTreeNode<Component>- Parameters:
s- the output to append
-
-