Module org.tquadrat.foundation.xml
Class NamespaceSupport
java.lang.Object
org.tquadrat.foundation.xml.builder.spi.NamespaceSupport
- Direct Known Subclasses:
AttributeSupport
@ClassVersion(sourceVersion="$Id: NamespaceSupport.java 980 2022-01-06 15:29:19Z tquadrat $")
@API(status=MAINTAINED,
since="0.0.5")
public sealed class NamespaceSupport
extends Object
permits AttributeSupport
This class provides the support for namespaces to elements.
Elements that also do support attributes should use
AttributeSupport
instead; that includes support for namespaces. In fact, that class extends
this one.
- Author:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: NamespaceSupport.java 980 2022-01-06 15:29:19Z tquadrat $
- Since:
- 0.0.5
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.xml.builder.spi.NamespaceSupport"
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe namespaces for the element.private final Element
The element that owns thisNamespaceSupport
instance. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal Collection
<Namespace> Provides access to the namespaces for this element; the returned collection is not modifiable.protected final Element
getOwner()
Returns the reference to the owner of this instance ofNamespaceSupport
.final void
setNamespace
(String identifier) Sets the given namespace.final void
setNamespace
(String prefix, String identifier) Sets the given namespace.
The given prefix is validated using the method that is provided byXMLBuilderUtils.getPrefixValidator()
.final void
setNamespace
(String prefix, URI identifier) Sets the given namespace.
The given prefix is validated using the method that is provided byXMLBuilderUtils.getPrefixValidator()
.final void
setNamespace
(URI identifier) Sets the given namespace.final void
setNamespace
(Namespace... namespace) Sets the given namespace.toString
(int indentationLevel, boolean prettyPrint) Returns the namespaces as a single formatted string.
-
Field Details
-
m_Namespaces
The namespaces for the element. -
m_Owner
The element that owns thisNamespaceSupport
instance.
-
-
Constructor Details
-
NamespaceSupport
Creates a newNamespaceSupport
instance.- Parameters:
owner
- The element that owns thisNamespaceSupport
instance.
-
-
Method Details
-
getNamespaces
Provides access to the namespaces for this element; the returned collection is not modifiable.- Returns:
- A reference the children of this element; if the element does not have children, an empty collection will be returned.
-
getOwner
Returns the reference to the owner of this instance ofNamespaceSupport
.- Returns:
- The owner.
-
setNamespace
Sets the given namespace.- Parameters:
namespace
- The namespace.
-
setNamespace
Sets the given namespace.- Parameters:
identifier
- The namespace identifier.
-
setNamespace
Sets the given namespace.- Parameters:
identifier
- The namespace identifier.- Throws:
URISyntaxException
- The provided URI String is invalid.
-
setNamespace
Sets the given namespace.
The given prefix is validated using the method that is provided byXMLBuilderUtils.getPrefixValidator()
.- Parameters:
prefix
- The namespace prefix.identifier
- The namespace identifier.
-
setNamespace
Sets the given namespace.
The given prefix is validated using the method that is provided byXMLBuilderUtils.getPrefixValidator()
.- Parameters:
prefix
- The namespace prefix.identifier
- The namespace identifier.- Throws:
URISyntaxException
- The provided URI String is invalid.
-
toString
Returns the namespaces as a single formatted string.- Parameters:
indentationLevel
- The indentation level.prettyPrint
- The pretty print flag.- Returns:
- The attributes string.
-