Package org.opensaml.core.xml.util
Class AttributeMap
java.lang.Object
org.opensaml.core.xml.util.AttributeMap
A map of attribute names and attribute values that invalidates the DOM of the attribute owning XMLObject when the
attributes change.
-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final XMLObject
XMLObject owning the attributes.Map of attributes.Set of attribute QNames which have been locally registered as having an ID type within this AttributeMap instance.private boolean
Flag indicating whether an attempt should be made to infer QName values, if attribute is not registered as a QName type.private final org.slf4j.Logger
Logger.Set of attribute QNames which have been locally registered as having an QName value type within this AttributeMap instance. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
checkAndDeregisterQNameValue
(QName attributeName, 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
(QName attributeName, String attributeValue) Check whether the attribute value is a QName type, and if it is, register it with the owner's namespace manger.private QName
checkQName
(QName attributeName, String attributeValue) Check where the attribute value is a QName type, and if so, return the QName.void
clear()
private String
constructAttributeValue
(QName attributeValue) Construct the string representation of a QName attribute value.boolean
containsKey
(Object key) boolean
containsValue
(Object value) void
deregisterID
(QName attributeName) Deregister an attribute as having a type of ID.void
deregisterQNameAttribute
(QName attributeName) Deregister an attribute as having a type of QName.private void
deregisterQNameValue
(QName attributeName) Deregister a QName attribute value with the owner's namespace manger.entrySet()
Returns the set of entries.boolean
isEmpty()
boolean
isIDAttribute
(QName attributeName) Check whether a given attribute is locally registered as having an ID type within this AttributeMap instance.boolean
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
(QName attributeName) Check whether a given attribute is known to have a QName type.keySet()
Returns the set of keys.Set an attribute value as a QName.void
void
registerID
(QName attributeName) Register an attribute as having a type of ID.void
registerQNameAttribute
(QName attributeName) Register an attribute as having a type of QName.private void
registerQNameValue
(QName attributeName, QName attributeValue) Register a QName attribute value with the owner's namespace manger.private void
Releases the DOM caching associated XMLObject and its ancestors.private QName
resolveQName
(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()
values()
Returns the values in this map.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
log
private final org.slf4j.Logger logLogger. -
attributeOwner
XMLObject owning the attributes. -
attributes
Map of attributes. -
idAttribNames
Set of attribute QNames which have been locally registered as having an ID type within this AttributeMap instance. -
qnameAttribNames
Set of attribute QNames which have been locally registered as having an QName value type within this AttributeMap instance. -
inferQNameValues
private boolean inferQNameValuesFlag indicating whether an attempt should be made to infer QName values, if attribute is not registered as a QName type.
-
-
Constructor Details
-
AttributeMap
Constructor.- Parameters:
newOwner
- the XMLObject that owns these attributes
-
-
Method Details
-
put
-
put
Set an attribute value as a QName. This method takes care of properly registering and deregistering the namespace information associated with the new QName being added, and with the old QName being possibly removed.- Parameters:
attributeName
- the attribute namevalue
- the QName attribute value- Returns:
- the old attribute value, possibly null
-
clear
public void clear() -
keySet
Returns the set of keys. -
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKey
in interfaceMap<QName,
String>
-
containsValue
- Specified by:
containsValue
in interfaceMap<QName,
String>
-
get
-
remove
-
putAll
-
values
Returns the values in this map. -
entrySet
Returns the set of entries. -
registerID
Register an attribute as having a type of ID.- Parameters:
attributeName
- the QName of the ID attribute to be registered
-
deregisterID
Deregister an attribute as having a type of ID.- Parameters:
attributeName
- the QName of the ID attribute to be de-registered
-
isIDAttribute
Check whether a given attribute is locally registered as having an ID type within this AttributeMap instance.- Parameters:
attributeName
- the QName of the attribute to be checked for ID type.- Returns:
- true if attribute is registered as having an ID type.
-
registerQNameAttribute
Register an attribute as having a type of QName.- Parameters:
attributeName
- the name of the QName-valued attribute to be registered
-
deregisterQNameAttribute
Deregister an attribute as having a type of QName.- Parameters:
attributeName
- the name of the QName-valued attribute to be registered
-
isQNameAttribute
Check whether a given attribute is known to have a QName type.- Parameters:
attributeName
- the QName of the attribute to be checked for QName type.- Returns:
- true if attribute is registered as having an QName type.
-
isInferQNameValues
public 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. Default is false.- Returns:
- true if QName types should be inferred, false if not
-
setInferQNameValues
public 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. Default is false.- Parameters:
flag
- true if QName types should be inferred, false if not
-
releaseDOM
private void releaseDOM()Releases the DOM caching associated XMLObject and its ancestors. -
checkAndRegisterQNameValue
Check whether the attribute value is a QName type, and if it is, register it with the owner's namespace manger.- Parameters:
attributeName
- the attribute nameattributeValue
- the attribute value
-
registerQNameValue
Register a QName attribute value with the owner's namespace manger.- Parameters:
attributeName
- the attribute nameattributeValue
- the attribute value
-
checkAndDeregisterQNameValue
Check whether the attribute value is a QName type, and if it is, deregister it with the owner's namespace manger.- Parameters:
attributeName
- the attribute nameattributeValue
- the attribute value
-
deregisterQNameValue
Deregister a QName attribute value with the owner's namespace manger.- Parameters:
attributeName
- the attribute name whose QName attribute value should be deregistered
-
checkQName
Check where the attribute value is a QName type, and if so, return the QName.- Parameters:
attributeName
- the attribute nameattributeValue
- the attribute value- Returns:
- the QName if the attribute value is a QName type, otherwise null
-
resolveQName
Attempt to resolve the specified attribute value into a QName.- Parameters:
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 namespace- Returns:
- the QName, or null if unable to resolve into a QName
-
constructAttributeValue
Construct the string representation of a QName attribute value.- Parameters:
attributeValue
- the QName to process- Returns:
- the attribute value string representation of the QName
-