Class SimpleNamespaceContext
- java.lang.Object
-
- net.shibboleth.utilities.java.support.xml.SimpleNamespaceContext
-
- All Implemented Interfaces:
NamespaceContext
@ThreadSafe public class SimpleNamespaceContext extends Object implements NamespaceContext
Simple implementation ofNamespaceContextbased on a map from prefix values to corresponding URIs. This implementation only supports a single mapping for a given prefix, that isgetPrefixes(String)will always contain at most 1 element.
-
-
Field Summary
Fields Modifier and Type Field Description private ImmutableBiMap<String,String>mappingsMappings between namespace prefixes and namespace URIs.
-
Constructor Summary
Constructors Constructor Description SimpleNamespaceContext()Constructor.SimpleNamespaceContext(Map<String,String> prefixToUriMappings)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private ImmutableBiMap.Builder<String,String>getMappingsBuilder()Build the initial set of mappings which contains entries for XML and XMLNS.StringgetNamespaceURI(String prefix)StringgetPrefix(String namespaceURI)Iterator<String>getPrefixes(String namespaceURI)
-
-
-
Field Detail
-
mappings
private final ImmutableBiMap<String,String> mappings
Mappings between namespace prefixes and namespace URIs.
-
-
Constructor Detail
-
SimpleNamespaceContext
public SimpleNamespaceContext()
Constructor.
-
SimpleNamespaceContext
public SimpleNamespaceContext(@Nullable @NullableElements Map<String,String> prefixToUriMappings)
Constructor.- Parameters:
prefixToUriMappings- Maps prefix values to the corresponding namespace URIs.
-
-
Method Detail
-
getNamespaceURI
@Nullable public String getNamespaceURI(String prefix)
- Specified by:
getNamespaceURIin interfaceNamespaceContext
-
getPrefix
@Nullable public String getPrefix(String namespaceURI)
- Specified by:
getPrefixin interfaceNamespaceContext
-
getPrefixes
@Nonnull public Iterator<String> getPrefixes(String namespaceURI)
- Specified by:
getPrefixesin interfaceNamespaceContext
-
getMappingsBuilder
@Nonnull private ImmutableBiMap.Builder<String,String> getMappingsBuilder()
Build the initial set of mappings which contains entries for XML and XMLNS.- Returns:
- initial set of mappings
-
-