Package com.ctc.wstx.sr
Class ElemAttrs
java.lang.Object
com.ctc.wstx.sr.ElemAttrs
Container class that is constructed with enough raw attribute information,
to be able to lazily construct full attribute objects, to be accessed
via Iterator, or fully-qualified name.
Implementation note: code for using Map-like structure is unfortunately
cut'n pasted from AttributeCollector
. Problem
with refactoring is that it's 90% the same code, but not 100%.
Although instances of this class are constructed by stream readers, it is actually used by element event objects.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
private final int[]
private final int
private final int
Raw offset (inmRawAttrs
) of the first attribute instance that was created through default value expansion.private final String[]
Array that contains 4 Strings for each attribute; localName, URI, prefix, value.private static final int
-
Constructor Summary
ConstructorsConstructorDescriptionMethod called to create "short" attribute list; list that has only few entries, and can thus be searched for attributes using linear search, without using any kind of Map structure.Method called to create "long" attribute list; list that has a few entries, and efficient access by fully-qualified name should not be done by linear search. -
Method Summary
Modifier and TypeMethodDescriptionint
private final int
findMapIndex
(String nsURI, String localName) Note: this method is very similar toinvalid reference
com.ctc.wstx.sr.AttributeCollector#getAttrValue
int
String[]
boolean
isDefault
(int ix)
-
Field Details
-
OFFSET_NS_URI
private static final int OFFSET_NS_URI- See Also:
-
mRawAttrs
Array that contains 4 Strings for each attribute; localName, URI, prefix, value. Can be used to lazily construct structure(s) needed to return Iterator for accessing all attributes. -
mDefaultOffset
private final int mDefaultOffsetRaw offset (inmRawAttrs
) of the first attribute instance that was created through default value expansion. -
mAttrMap
private final int[] mAttrMap -
mAttrHashSize
private final int mAttrHashSize -
mAttrSpillEnd
private final int mAttrSpillEnd
-
-
Constructor Details
-
ElemAttrs
Method called to create "short" attribute list; list that has only few entries, and can thus be searched for attributes using linear search, without using any kind of Map structure.Currently the limit is 4 attributes; 1, 2 or 3 attribute lists are considered short, 4 or more 'long'.
- Parameters:
rawAttrs
- Array that contains 4 Strings for each attribute; localName, URI, prefix, value. Can be used to lazily construct structure(s) needed to return Iterator for accessing all attributes.defOffset
- Index of the first default attribute, if any; number of all attributes if none
-
ElemAttrs
Method called to create "long" attribute list; list that has a few entries, and efficient access by fully-qualified name should not be done by linear search.- Parameters:
rawAttrs
- Array that contains 4 Strings for each attribute; localName, URI, prefix, value. Can be used to lazily construct structure(s) needed to return Iterator for accessing all attributes.
-
-
Method Details
-
getRawAttrs
-
findIndex
-
getFirstDefaultOffset
public int getFirstDefaultOffset() -
isDefault
public boolean isDefault(int ix) -
findMapIndex
Note: this method is very similar to
invalid reference
com.ctc.wstx.sr.AttributeCollector#getAttrValue
-