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 org.opensaml.saml.saml2.core.Attribute
getAttribute
(String name, List<org.opensaml.saml.saml2.core.Attribute> attributes) Returns an attribute with a given name from an attribute list.static String
getAttributeStringValue
(org.opensaml.saml.saml2.core.Attribute attribute) Given a single-valued string attribute, this method returns its string value.getAttributeStringValues
(org.opensaml.saml.saml2.core.Attribute attribute) Given an attribute holding string values this method will return a list of these values.static <T extends org.opensaml.core.xml.XMLObject>
TgetAttributeValue
(org.opensaml.saml.saml2.core.Attribute attribute, Class<T> type) Given a single-valued attribute, this method returns its value (of the given type).static <T extends org.opensaml.core.xml.XMLObject>
List<T> getAttributeValues
(org.opensaml.saml.saml2.core.Attribute attribute, Class<T> type) Returns the attribute values of the given type.
-
Method Details
-
getAttributeStringValues
public static List<String> getAttributeStringValues(org.opensaml.saml.saml2.core.Attribute attribute) 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
public static <T extends org.opensaml.core.xml.XMLObject> List<T> getAttributeValues(org.opensaml.saml.saml2.core.Attribute attribute, Class<T> type) 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
public static <T extends org.opensaml.core.xml.XMLObject> T getAttributeValue(org.opensaml.saml.saml2.core.Attribute attribute, Class<T> type) 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
public static org.opensaml.saml.saml2.core.Attribute getAttribute(String name, List<org.opensaml.saml.saml2.core.Attribute> attributes) 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
-