Class AttributeUtils
java.lang.Object
se.swedenconnect.opensaml.saml2.attribute.AttributeUtils
Helper methods for accessing attribute values. See also
AttributeBuilder
.- Author:
- Martin Lindström (martin@idsec.se)
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic Attribute
getAttribute
(String name, List<Attribute> attributes) Returns an attribute with a given name from an attribute list.static String
getAttributeStringValue
(Attribute attribute) Given a single-valued string attribute, this method returns its string value.getAttributeStringValues
(Attribute attribute) Given an attribute holding string values this method will return a list of these values.static <T extends XMLObject>
TgetAttributeValue
(Attribute attribute, Class<T> type) Given a single-valued attribute, this method returns its value (of the given type).getAttributeValues
(Attribute attribute, Class<T> type) Returns the attribute values of the given type.
-
Method Details
-
getAttributeStringValues
Given an attribute holding string values this method will return a list of these values.- Parameters:
attribute
- the attribute- Returns:
- a (possibly empty) list of string values
-
getAttributeStringValue
Given a single-valued string attribute, this method returns its string value.- Parameters:
attribute
- the attribute- Returns:
- the value, or null if no value is stored
-
getAttributeValues
Returns the attribute values of the given type.- Type Parameters:
T
- the value type- Parameters:
attribute
- the attributetype
- the type to match- Returns:
- a (possibly empty) list of values.
-
getAttributeValue
Given a single-valued attribute, this method returns its value (of the given type).- Type Parameters:
T
- the value type- Parameters:
attribute
- the attributetype
- the type to match- Returns:
- the value, or
null
-
getAttribute
Returns an attribute with a given name from an attribute list.- Parameters:
name
- the attribute nameattributes
- the list of attributes- Returns:
- the attribute or null
-