Package org.opensaml.core.xml.util
Class AttributeMap
- java.lang.Object
-
- org.opensaml.core.xml.util.AttributeMap
-
-
Field Summary
Fields Modifier and Type Field Description private XMLObjectattributeOwnerXMLObject owning the attributes.private Map<QName,String>attributesMap of attributes.private Set<QName>idAttribNamesSet of attribute QNames which have been locally registered as having an ID type within this AttributeMap instance.private booleaninferQNameValuesFlag indicating whether an attempt should be made to infer QName values, if attribute is not registered as a QName type.private org.slf4j.LoggerlogLogger.private Set<QName>qnameAttribNamesSet of attribute QNames which have been locally registered as having an QName value type within this AttributeMap instance.
-
Constructor Summary
Constructors Constructor Description AttributeMap(XMLObject newOwner)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcheckAndDeregisterQNameValue(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 voidcheckAndRegisterQNameValue(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 QNamecheckQName(QName attributeName, String attributeValue)Check where the attribute value is a QName type, and if so, return the QName.voidclear()private StringconstructAttributeValue(QName attributeValue)Construct the string representation of a QName attribute value.booleancontainsKey(Object key)booleancontainsValue(Object value)voidderegisterID(QName attributeName)Deregister an attribute as having a type of ID.voidderegisterQNameAttribute(QName attributeName)Deregister an attribute as having a type of QName.private voidderegisterQNameValue(QName attributeName)Deregister a QName attribute value with the owner's namespace manger.Set<Map.Entry<QName,String>>entrySet()Returns the set of entries.Stringget(Object key)booleanisEmpty()booleanisIDAttribute(QName attributeName)Check whether a given attribute is locally registered as having an ID type within this AttributeMap instance.booleanisInferQNameValues()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.booleanisQNameAttribute(QName attributeName)Check whether a given attribute is known to have a QName type.Set<QName>keySet()Returns the set of keys.Stringput(QName attributeName, String value)QNameput(QName attributeName, QName value)Set an attribute value as a QName.voidputAll(Map<? extends QName,? extends String> t)voidregisterID(QName attributeName)Register an attribute as having a type of ID.voidregisterQNameAttribute(QName attributeName)Register an attribute as having a type of QName.private voidregisterQNameValue(QName attributeName, QName attributeValue)Register a QName attribute value with the owner's namespace manger.private voidreleaseDOM()Releases the DOM caching associated XMLObject and its ancestors.Stringremove(Object key)private QNameresolveQName(String attributeValue, boolean isDefaultNSOK)Attempt to resolve the specified attribute value into a QName.voidsetInferQNameValues(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.intsize()Collection<String>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 Detail
-
log
private final org.slf4j.Logger log
Logger.
-
attributeOwner
private final XMLObject attributeOwner
XMLObject owning the attributes.
-
idAttribNames
private Set<QName> idAttribNames
Set of attribute QNames which have been locally registered as having an ID type within this AttributeMap instance.
-
qnameAttribNames
private Set<QName> qnameAttribNames
Set of attribute QNames which have been locally registered as having an QName value type within this AttributeMap instance.
-
inferQNameValues
private boolean inferQNameValues
Flag indicating whether an attempt should be made to infer QName values, if attribute is not registered as a QName type.
-
-
Constructor Detail
-
AttributeMap
public AttributeMap(@Nonnull XMLObject newOwner)Constructor.- Parameters:
newOwner- the XMLObject that owns these attributes
-
-
Method Detail
-
put
public QName put(QName attributeName, QName value)
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
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceMap<QName,String>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValuein interfaceMap<QName,String>
-
values
public Collection<String> values()
Returns the values in this map.
-
registerID
public void registerID(QName attributeName)
Register an attribute as having a type of ID.- Parameters:
attributeName- the QName of the ID attribute to be registered
-
deregisterID
public void deregisterID(QName attributeName)
Deregister an attribute as having a type of ID.- Parameters:
attributeName- the QName of the ID attribute to be de-registered
-
isIDAttribute
public boolean isIDAttribute(QName attributeName)
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
public void registerQNameAttribute(QName attributeName)
Register an attribute as having a type of QName.- Parameters:
attributeName- the name of the QName-valued attribute to be registered
-
deregisterQNameAttribute
public void deregisterQNameAttribute(QName attributeName)
Deregister an attribute as having a type of QName.- Parameters:
attributeName- the name of the QName-valued attribute to be registered
-
isQNameAttribute
public boolean isQNameAttribute(QName attributeName)
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
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.- Parameters:
attributeName- the attribute nameattributeValue- the attribute value
-
registerQNameValue
private void registerQNameValue(QName attributeName, QName attributeValue)
Register a QName attribute value with the owner's namespace manger.- Parameters:
attributeName- the attribute nameattributeValue- the attribute value
-
checkAndDeregisterQNameValue
private 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.- Parameters:
attributeName- the attribute nameattributeValue- the attribute value
-
deregisterQNameValue
private void deregisterQNameValue(QName attributeName)
Deregister a QName attribute value with the owner's namespace manger.- Parameters:
attributeName- the attribute name whose QName attribute value should be deregistered
-
checkQName
private QName checkQName(QName attributeName, String attributeValue)
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
private QName resolveQName(String attributeValue, boolean isDefaultNSOK)
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
-
-