com.fasterxml.aalto.in
Class FixedNsContext

java.lang.Object
  extended by com.fasterxml.aalto.in.FixedNsContext
All Implemented Interfaces:
NamespaceContext

public final class FixedNsContext
extends Object
implements NamespaceContext

Non-transient implementation of NamespaceContext.


Field Summary
protected  String[] _declarationData
          Array that contains prefix/namespace-uri pairs, ordered from the most recent declaration to older ones.
protected  NsDeclaration _lastDeclaration
          We will keep a reference to the last namespace declaration in effect at point when this instance was created.
protected  ArrayList<String> _tmpDecl
          Temporary List used for constructing compact namespace binding information that we will actually use.
static FixedNsContext EMPTY_CONTEXT
          We can share and reuse "no bindings" instance.
 
Method Summary
 String getNamespaceURI(String prefix)
           
 String getPrefix(String nsURI)
           
 Iterator<?> getPrefixes(String nsURI)
           
 FixedNsContext reuseOrCreate(NsDeclaration currLastDecl)
          Method called to either reuse this context or construct a new one.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_CONTEXT

public static final FixedNsContext EMPTY_CONTEXT
We can share and reuse "no bindings" instance.


_lastDeclaration

protected final NsDeclaration _lastDeclaration
We will keep a reference to the last namespace declaration in effect at point when this instance was created. This is used for lazy invalidation of instances: if last declaration for an instance differs from the last seen by the reader, a new context must be created.


_declarationData

protected final String[] _declarationData
Array that contains prefix/namespace-uri pairs, ordered from the most recent declaration to older ones. Array is always exactly sized so there are no empty entries at the end.


_tmpDecl

protected ArrayList<String> _tmpDecl
Temporary List used for constructing compact namespace binding information that we will actually use.

Method Detail

reuseOrCreate

public FixedNsContext reuseOrCreate(NsDeclaration currLastDecl)
Method called to either reuse this context or construct a new one. Reuse is ok if the currently active last declaration has not changed since time this instance was created.


getNamespaceURI

public final String getNamespaceURI(String prefix)
Specified by:
getNamespaceURI in interface NamespaceContext

getPrefix

public final String getPrefix(String nsURI)
Specified by:
getPrefix in interface NamespaceContext

getPrefixes

public final Iterator<?> getPrefixes(String nsURI)
Specified by:
getPrefixes in interface NamespaceContext

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012 Fasterxml.com. All Rights Reserved.