Top Description Fields Constructors Methods
com.fasterxml.aalto.dom

public final Class BijectiveNsMap

extends Object
Class Inheritance
Imports
java.util.*, javax.xml.XMLConstants, javax.xml.namespace.NamespaceContext

Helper class that implements "bijective map" (Map that allows use of values as keys and vice versa, bidirectional access), and is specifically used for storing namespace binding information. One thing worth noting is that Strings stored are NOT assumed to have been unified (interned) -- if they were, different implementation would be more optimal.

Field Summary

Modifier and TypeField and Description
pack-priv String[]
_nsStrings

Array that contains { prefix, ns-uri } pairs, up to (but not including) index _scopeEnd.

pack-priv int
pack-priv final int
pack-priv static final int
DEFAULT_ARRAY_SIZE

Let's plan for having up to 14 explicit namespace declarations (2 defaults, for 'xml' and 'xmlns', are pre-populated)

Constructor Summary

AccessConstructor and Description
private
BijectiveNsMap(int scopeStart, String[] strs)

Method Summary

Modifier and TypeMethod and Description
public String
addGeneratedMapping(String prefixBase, NamespaceContext ctxt, String uri, int[] seqArr)

Method used to add a dynamic binding, and return the prefix used to bind the specified namespace URI.

public String

Returns:

If the prefix was already bound, the URI it was bound to: null if it's a new binding for the current scope.
addMapping
(String
Prefix to bind
prefix
,
String
URI to bind to the prefix
uri
)

Method to add a new prefix-to-URI mapping for the current scope.

public BijectiveNsMap
public static BijectiveNsMap
public String
public String
public List<String>
public int
public int
size()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_nsStringsback to summary
pack-priv String[] _nsStrings

Array that contains { prefix, ns-uri } pairs, up to (but not including) index _scopeEnd.

_scopeEndback to summary
pack-priv int _scopeEnd
_scopeStartback to summary
pack-priv final int _scopeStart
DEFAULT_ARRAY_SIZEback to summary
pack-priv static final int DEFAULT_ARRAY_SIZE

Let's plan for having up to 14 explicit namespace declarations (2 defaults, for 'xml' and 'xmlns', are pre-populated)

Constructor Detail

BijectiveNsMapback to summary
private BijectiveNsMap(int scopeStart, String[] strs)

Method Detail

addGeneratedMappingback to summary
public String addGeneratedMapping(String prefixBase, NamespaceContext ctxt, String uri, int[] seqArr)

Method used to add a dynamic binding, and return the prefix used to bind the specified namespace URI.

addMappingback to summary
public String addMapping(String prefix, String uri)

Method to add a new prefix-to-URI mapping for the current scope. Note that it should NOT be used for the default namespace declaration

Parameters
prefix:String

Prefix to bind

uri:String

URI to bind to the prefix

Returns:String

If the prefix was already bound, the URI it was bound to: null if it's a new binding for the current scope.

createChildback to summary
public BijectiveNsMap createChild()
createEmptyback to summary
public static BijectiveNsMap createEmpty()
findPrefixByUriback to summary
public String findPrefixByUri(String uri)
findUriByPrefixback to summary
public String findUriByPrefix(String prefix)
getPrefixesBoundToUriback to summary
public List<String> getPrefixesBoundToUri(String uri, List<String> l)
localSizeback to summary
public int localSize()
sizeback to summary
public int size()