Class DeclaredNamespaces
java.lang.Object
org.pentaho.reporting.libraries.xmlns.writer.DeclaredNamespaces
A immutable namespace collection. Any attempt to modify the declared namespaces creates a new copy of the map.
- Author:
- Thomas Morgner
-
Constructor Summary
ConstructorDescriptionCreates a new namespaces collection.DeclaredNamespaces
(DeclaredNamespaces namespaces) Creates a new namespaces collection using the given namespaces as initial values. -
Method Summary
Modifier and TypeMethodDescriptionAdds a single namespace definition to the collection.Adds all namespaces from the given hashmap into this map.add
(AttributeList attributes) Adds all declared namespaces from the given attribute-list into the namespaces collection.Returns all known namespaces as unmodifiable map.Looksup the prefix for the given URI.boolean
isNamespaceDefined
(String uri) Checks, whether the namespace marked by the given URI is defined in this collection.boolean
isPrefixDefined
(String prefix) Checks whether the given prefix is already defined in the collection.
-
Constructor Details
-
DeclaredNamespaces
public DeclaredNamespaces()Creates a new namespaces collection. -
DeclaredNamespaces
Creates a new namespaces collection using the given namespaces as initial values.- Parameters:
namespaces
- the namespaces, never null.
-
-
Method Details
-
add
Adds all namespaces from the given hashmap into this map. The namespaces map must only contain string keys and string values and must not contain either null-keys or null-values.- Parameters:
newNamespaces
- the namespaces collection.- Returns:
- the created namespaces object.
-
add
Adds all declared namespaces from the given attribute-list into the namespaces collection.- Parameters:
attributes
- the attribute list containing namespace definitions.- Returns:
- the new namespaces collection.
-
add
Adds a single namespace definition to the collection.- Parameters:
uri
- the URI of the namespace.prefix
- the prefix to be used for the namespace.- Returns:
- the new namespaces collection.
-
getPrefix
Looksup the prefix for the given URI. This returns null if the URI is not a declared namespace.- Parameters:
uri
- the URI.- Returns:
- the prefix for the given URI or null, if the URI is not part of this collection.
-
isNamespaceDefined
Checks, whether the namespace marked by the given URI is defined in this collection.- Parameters:
uri
- the URI to be checked.- Returns:
- true, if the URI is known, false otherwise.
-
getNamespaces
Returns all known namespaces as unmodifiable map.- Returns:
- the namespaces.
-
isPrefixDefined
Checks whether the given prefix is already defined in the collection.- Parameters:
prefix
- the prefix.- Returns:
- true, if the prefix is already used, false otherwise.
-