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.String
getLocalName()
Returns the XML local name for this node.java.lang.String
getNamespace()
Returns the namespace of this node.java.lang.String
getPrefix()
Returns the namespace prefix for marshaling this node, ornull
if the namespace should override the default namespace.int
getType()
Returns the XML node type.boolean
isNamespaceAware()
Returnstrue
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
isOptional()
Returns whether this node must exist during unmarshalling.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(java.lang.String localName)
void
setNamespace(java.lang.String namespace)
void
setNamespaceAware(boolean namespaceAware)
void
setNillable(boolean nillable)
void
setPrefix(java.lang.String prefix)
void
setRepeating(boolean repeating)
protected void
toParamString(java.lang.StringBuilder s)
Called byTreeNode.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, isDescendant, iterator, print, print, setName, size, sort, toString, updateReferences
-
-
-
-
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 interfaceParser
- Overrides:
matches
in classDelegatingParser
- Parameters:
context
- theUnmarshallingContext
- Returns:
- true if matched, false otherwise
-
unmarshal
public boolean unmarshal(UnmarshallingContext context)
Description copied from interface:Parser
Unmarshals a record.- Specified by:
unmarshal
in interfaceParser
- Overrides:
unmarshal
in classDelegatingParser
- Parameters:
context
- theUnmarshallingContext
- Returns:
true
if this component was present in the unmarshalled record, orfalse
otherwise
-
marshal
public boolean marshal(MarshallingContext context) throws java.io.IOException
Description copied from interface:Parser
Marshals a record.- Specified by:
marshal
in interfaceParser
- Overrides:
marshal
in 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:XmlNode
Returns the XML local name for this node.- Specified by:
getLocalName
in interfaceXmlNode
- Returns:
- the XML local name
-
setLocalName
public void setLocalName(java.lang.String localName)
-
getPrefix
public java.lang.String getPrefix()
Description copied from interface:XmlNode
Returns the namespace prefix for marshaling this node, ornull
if 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: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 interfaceXmlNode
- Returns:
- the XML namespace of this node
-
setNamespace
public void setNamespace(java.lang.String namespace)
-
isNamespaceAware
public boolean isNamespaceAware()
Description copied from interface:XmlNode
Returnstrue
if a namespace was configured for this node, and is therefore used to unmarshal and marshal the node.- Specified by:
isNamespaceAware
in interfaceXmlNode
- 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 interfaceXmlNode
- 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 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:XmlNode
Returns whether this node may repeat in the context of its immediate parent.- Specified by:
isRepeating
in interfaceXmlNode
- Returns:
- true if this node repeats, false otherwise
-
setRepeating
public void setRepeating(boolean repeating)
-
isOptional
public boolean isOptional()
Description copied from interface:Parser
Returns whether this node must exist during unmarshalling.- Specified by:
isOptional
in interfaceParser
- Overrides:
isOptional
in 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:TreeNode
Called byTreeNode.toString()
to append node parameters to the output.- Overrides:
toParamString
in classTreeNode<Component>
- Parameters:
s
- the output to append
-
-