Package org.simpleframework.xml.core
Class NamespaceDecorator
- java.lang.Object
-
- org.simpleframework.xml.core.NamespaceDecorator
-
- All Implemented Interfaces:
Decorator
class NamespaceDecorator extends java.lang.Object implements Decorator
TheNamespaceDecorator
object is used to decorate any output node with namespaces. All namespaces added to this are applied to nodes that require decoration. This can add namespaces to the node as well as setting the primary namespace reference for the node. This results in qualification for the node.- See Also:
Qualifier
-
-
Constructor Summary
Constructors Constructor Description NamespaceDecorator()
Constructor for theNamespaceDecorator
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Namespace namespace)
This is used to add a namespace to the decorator so that it can be added to decorated nodes.void
decorate(OutputNode node)
This method is used to decorate the provided node.void
decorate(OutputNode node, Decorator decorator)
This method is used to decorate the provided node.private void
namespace(OutputNode node)
This is use to apply theNamespace
annotations on the node.private void
scope(OutputNode node)
This is use to apply forNamespaceList
annotations on the node.void
set(Namespace namespace)
This is used to set the primary namespace for nodes that will be decorated by the namespace decorator.
-
-
-
Constructor Detail
-
NamespaceDecorator
public NamespaceDecorator()
Constructor for theNamespaceDecorator
object. A namespace decorator can be used for applying namespaces to a specified node. It can add namespaces to set the scope of the namespace reference to the node and it can also be used to set the primary namespace reference used for the node.
-
-
Method Detail
-
set
public void set(Namespace namespace)
This is used to set the primary namespace for nodes that will be decorated by the namespace decorator. If no namespace is set using this method then this decorator will leave the namespace reference unchanged and only add namespaces for scoping.- Parameters:
namespace
- this is the primary namespace to be set
-
add
public void add(Namespace namespace)
This is used to add a namespace to the decorator so that it can be added to decorated nodes. Namespaces that are added will be set on the element so that child elements can reference the namespace and will thus inherit the prefix from that elment.- Parameters:
namespace
- this is the namespace to be added for scoping
-
decorate
public void decorate(OutputNode node)
This method is used to decorate the provided node. This node can be either an XML element or an attribute. Decorations that can be applied to the node by invoking this method include things like comments and namespaces.
-
decorate
public void decorate(OutputNode node, Decorator decorator)
This method is used to decorate the provided node. This node can be either an XML element or an attribute. Decorations that can be applied to the node by invoking this method include things like namespaces and namespace lists. This can also be given anotherDecorator
which is applied before this decorator, any common data can then be overwritten.
-
scope
private void scope(OutputNode node)
This is use to apply forNamespaceList
annotations on the node. If there is no namespace list then this will return and the node will be left unchanged. If however the namespace list is not empty the the namespaces are added.- Parameters:
node
- this is the node to apply the namespace list to
-
namespace
private void namespace(OutputNode node)
This is use to apply theNamespace
annotations on the node. If there is no namespace then this will return and the node will be left unchanged. If however the namespace is not null then the reference is applied to the specified node.- Parameters:
node
- this is the node to apply the namespace to
-
-