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 ElementThe element that owns thisNamespaceSupportinstance. -
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 ElementgetOwner()Returns the reference to the owner of this instance ofNamespaceSupport.final voidsetNamespace(String identifier) Sets the given namespace.final voidsetNamespace(String prefix, String identifier) Sets the given namespace.
The given prefix is validated using the method that is provided byXMLBuilderUtils.getPrefixValidator().final voidsetNamespace(String prefix, URI identifier) Sets the given namespace.
The given prefix is validated using the method that is provided byXMLBuilderUtils.getPrefixValidator().final voidsetNamespace(URI identifier) Sets the given namespace.final voidsetNamespace(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 thisNamespaceSupportinstance.
-
-
Constructor Details
-
NamespaceSupport
Creates a newNamespaceSupportinstance.- Parameters:
owner- The element that owns thisNamespaceSupportinstance.
-
-
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.
-
