Class NamespaceDecorator

java.lang.Object
org.simpleframework.xml.core.NamespaceDecorator
All Implemented Interfaces:
Decorator

class NamespaceDecorator extends Object implements Decorator
The NamespaceDecorator 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:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private Namespace
    This is used to set the primary namespace reference used.
    private List<Namespace>
    This is used to contain the namespaces used for scoping.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor for the NamespaceDecorator object.
  • Method Summary

    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
    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
    This is use to apply the Namespace annotations on the node.
    private void
    This is use to apply for NamespaceList 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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • scope

      private List<Namespace> scope
      This is used to contain the namespaces used for scoping.
    • primary

      private Namespace primary
      This is used to set the primary namespace reference used.
  • Constructor Details

    • NamespaceDecorator

      public NamespaceDecorator()
      Constructor for the NamespaceDecorator 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 Details

    • 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.
      Specified by:
      decorate in interface Decorator
      Parameters:
      node - this is the node that is to be decorated by this
    • 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 another Decorator which is applied before this decorator, any common data can then be overwritten.
      Specified by:
      decorate in interface Decorator
      Parameters:
      node - this is the node that is to be decorated by this
      decorator - this is a secondary decorator to be applied
    • scope

      private void scope(OutputNode node)
      This is use to apply for NamespaceList 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 the Namespace 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