@NotThreadSafe
public class AttributeMap
extends java.lang.Object
implements java.util.Map<javax.xml.namespace.QName,java.lang.String>
| Modifier and Type | Field and Description |
|---|---|
private XMLObject |
attributeOwner
XMLObject owning the attributes.
|
private java.util.Map<javax.xml.namespace.QName,java.lang.String> |
attributes
Map of attributes.
|
private java.util.Set<javax.xml.namespace.QName> |
idAttribNames
Set of attribute QNames which have been locally registered as having an ID type within this
AttributeMap instance.
|
private boolean |
inferQNameValues
Flag indicating whether an attempt should be made to infer QName values,
if attribute is not registered as a QName type.
|
private org.slf4j.Logger |
log
Logger.
|
private java.util.Set<javax.xml.namespace.QName> |
qnameAttribNames
Set of attribute QNames which have been locally registered as having an QName value type within this
AttributeMap instance.
|
| Constructor and Description |
|---|
AttributeMap(XMLObject newOwner)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
checkAndDeregisterQNameValue(javax.xml.namespace.QName attributeName,
java.lang.String attributeValue)
Check whether the attribute value is a QName type, and if it is,
deregister it with the owner's namespace manger.
|
private void |
checkAndRegisterQNameValue(javax.xml.namespace.QName attributeName,
java.lang.String attributeValue)
Check whether the attribute value is a QName type, and if it is,
register it with the owner's namespace manger.
|
private javax.xml.namespace.QName |
checkQName(javax.xml.namespace.QName attributeName,
java.lang.String attributeValue)
Check where the attribute value is a QName type, and if so, return the QName.
|
void |
clear() |
private java.lang.String |
constructAttributeValue(javax.xml.namespace.QName attributeValue)
Construct the string representation of a QName attribute value.
|
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
void |
deregisterID(javax.xml.namespace.QName attributeName)
Deregister an attribute as having a type of ID.
|
void |
deregisterQNameAttribute(javax.xml.namespace.QName attributeName)
Deregister an attribute as having a type of QName.
|
private void |
deregisterQNameValue(javax.xml.namespace.QName attributeName)
Deregister a QName attribute value with the owner's namespace manger.
|
java.util.Set<java.util.Map.Entry<javax.xml.namespace.QName,java.lang.String>> |
entrySet()
Returns the set of entries.
|
java.lang.String |
get(java.lang.Object key) |
boolean |
isEmpty() |
boolean |
isIDAttribute(javax.xml.namespace.QName attributeName)
Check whether a given attribute is locally registered as having an ID type within
this AttributeMap instance.
|
boolean |
isInferQNameValues()
Get the flag indicating whether an attempt should be made to infer QName values,
if attribute is not registered via a configuration as a QName type.
|
boolean |
isQNameAttribute(javax.xml.namespace.QName attributeName)
Check whether a given attribute is known to have a QName type.
|
java.util.Set<javax.xml.namespace.QName> |
keySet()
Returns the set of keys.
|
javax.xml.namespace.QName |
put(javax.xml.namespace.QName attributeName,
javax.xml.namespace.QName value)
Set an attribute value as a QName.
|
java.lang.String |
put(javax.xml.namespace.QName attributeName,
java.lang.String value) |
void |
putAll(java.util.Map<? extends javax.xml.namespace.QName,? extends java.lang.String> t) |
void |
registerID(javax.xml.namespace.QName attributeName)
Register an attribute as having a type of ID.
|
void |
registerQNameAttribute(javax.xml.namespace.QName attributeName)
Register an attribute as having a type of QName.
|
private void |
registerQNameValue(javax.xml.namespace.QName attributeName,
javax.xml.namespace.QName attributeValue)
Register a QName attribute value with the owner's namespace manger.
|
private void |
releaseDOM()
Releases the DOM caching associated XMLObject and its ancestors.
|
java.lang.String |
remove(java.lang.Object key) |
private javax.xml.namespace.QName |
resolveQName(java.lang.String attributeValue,
boolean isDefaultNSOK)
Attempt to resolve the specified attribute value into a QName.
|
void |
setInferQNameValues(boolean flag)
Set the flag indicating whether an attempt should be made to infer QName values,
if attribute is not registered via a configuration as a QName type.
|
int |
size() |
java.util.Collection<java.lang.String> |
values()
Returns the values in this map.
|
private final org.slf4j.Logger log
private final XMLObject attributeOwner
private java.util.Map<javax.xml.namespace.QName,java.lang.String> attributes
private java.util.Set<javax.xml.namespace.QName> idAttribNames
private java.util.Set<javax.xml.namespace.QName> qnameAttribNames
private boolean inferQNameValues
public AttributeMap(@Nonnull
XMLObject newOwner)
newOwner - the XMLObject that owns these attributespublic java.lang.String put(javax.xml.namespace.QName attributeName,
java.lang.String value)
put in interface java.util.Map<javax.xml.namespace.QName,java.lang.String>public javax.xml.namespace.QName put(javax.xml.namespace.QName attributeName,
javax.xml.namespace.QName value)
attributeName - the attribute namevalue - the QName attribute valuepublic void clear()
clear in interface java.util.Map<javax.xml.namespace.QName,java.lang.String>public java.util.Set<javax.xml.namespace.QName> keySet()
keySet in interface java.util.Map<javax.xml.namespace.QName,java.lang.String>public int size()
size in interface java.util.Map<javax.xml.namespace.QName,java.lang.String>public boolean isEmpty()
isEmpty in interface java.util.Map<javax.xml.namespace.QName,java.lang.String>public boolean containsKey(java.lang.Object key)
containsKey in interface java.util.Map<javax.xml.namespace.QName,java.lang.String>public boolean containsValue(java.lang.Object value)
containsValue in interface java.util.Map<javax.xml.namespace.QName,java.lang.String>public java.lang.String get(java.lang.Object key)
get in interface java.util.Map<javax.xml.namespace.QName,java.lang.String>public java.lang.String remove(java.lang.Object key)
remove in interface java.util.Map<javax.xml.namespace.QName,java.lang.String>public void putAll(java.util.Map<? extends javax.xml.namespace.QName,? extends java.lang.String> t)
putAll in interface java.util.Map<javax.xml.namespace.QName,java.lang.String>public java.util.Collection<java.lang.String> values()
values in interface java.util.Map<javax.xml.namespace.QName,java.lang.String>public java.util.Set<java.util.Map.Entry<javax.xml.namespace.QName,java.lang.String>> entrySet()
entrySet in interface java.util.Map<javax.xml.namespace.QName,java.lang.String>public void registerID(javax.xml.namespace.QName attributeName)
attributeName - the QName of the ID attribute to be registeredpublic void deregisterID(javax.xml.namespace.QName attributeName)
attributeName - the QName of the ID attribute to be de-registeredpublic boolean isIDAttribute(javax.xml.namespace.QName attributeName)
attributeName - the QName of the attribute to be checked for ID type.public void registerQNameAttribute(javax.xml.namespace.QName attributeName)
attributeName - the name of the QName-valued attribute to be registeredpublic void deregisterQNameAttribute(javax.xml.namespace.QName attributeName)
attributeName - the name of the QName-valued attribute to be registeredpublic boolean isQNameAttribute(javax.xml.namespace.QName attributeName)
attributeName - the QName of the attribute to be checked for QName type.public boolean isInferQNameValues()
public void setInferQNameValues(boolean flag)
flag - true if QName types should be inferred, false if notprivate void releaseDOM()
private void checkAndRegisterQNameValue(javax.xml.namespace.QName attributeName,
java.lang.String attributeValue)
attributeName - the attribute nameattributeValue - the attribute valueprivate void registerQNameValue(javax.xml.namespace.QName attributeName,
javax.xml.namespace.QName attributeValue)
attributeName - the attribute nameattributeValue - the attribute valueprivate void checkAndDeregisterQNameValue(javax.xml.namespace.QName attributeName,
java.lang.String attributeValue)
attributeName - the attribute nameattributeValue - the attribute valueprivate void deregisterQNameValue(javax.xml.namespace.QName attributeName)
attributeName - the attribute name whose QName attribute value should be deregisteredprivate javax.xml.namespace.QName checkQName(javax.xml.namespace.QName attributeName,
java.lang.String attributeValue)
attributeName - the attribute nameattributeValue - the attribute valueprivate javax.xml.namespace.QName resolveQName(java.lang.String attributeValue,
boolean isDefaultNSOK)
attributeValue - the value to evaluateisDefaultNSOK - flag indicating whether resolution should be attempted if the prefix is null,
that is, the value is considered to be be potentially in the default XML namespaceprivate java.lang.String constructAttributeValue(javax.xml.namespace.QName attributeValue)
attributeValue - the QName to process