Class AttributeList
java.lang.Object
com.ibm.oauth.core.api.attributes.AttributeList
An ordered list of attributes used throughout the component to communicate full
state and information in OAuth request and response. An attribute will be uniquely
identified in the list by its name and type. Therefore an attribute list
cannot have two attributes with the same name and type.
-
Constructor Summary
ConstructorDescriptionOne and only constructor which builds a new empty list of attributes. -
Method Summary
Modifier and TypeMethodDescriptionGets all attributes in the attribute list.getAttributeByNameAndType
(String name, String type) Returns a reference to an attribute within the attribute list identified by its name and type.getAttributesByType
(String type) Returns an array of attributes from the list that match a given type.Returns the first string value of an attribute from the attribute list identified by its name only.getAttributeValueByNameAndType
(String name, String type) Returns the first string value of an attribute from the attribute list identified by its name and type.String[]
Returns the list of string values (as a string array) of an attribute from the attribute list identified by its name only.String[]
getAttributeValuesByNameAndType
(String name, String type) Returns the list of string values (as a string array) of an attribute from the attribute list identified by its name and type.void
setAttribute
(String name, String type, String[] values) Set the values of an attribute in the attribute list identified by name and type.toString()
String representation of the attribute list useful for debug tracing.
-
Constructor Details
-
AttributeList
public AttributeList()One and only constructor which builds a new empty list of attributes.
-
-
Method Details
-
getAttributeValueByNameAndType
Returns the first string value of an attribute from the attribute list identified by its name and type. Name and type checking are done as string comparisons. If the type of an attribute is not defined (null) then it will ONLY match if the requested type is also null. Similarly if the requested type is null, only attributes with a null (undefined) type will be matched.- Parameters:
name
- name of attributetype
- type of attribute- Returns:
- first string value of a matching attribute from the attribute list or null if no matching attribute
-
getAttributeValueByName
Returns the first string value of an attribute from the attribute list identified by its name only. If more than one attribute in the attribute list has the same name (and different types), the first value of the first matching attribute will be returned.- Parameters:
name
- name of attribute- Returns:
- first string value of a matching attribute from the attribute list or null if no matching attribute
-
getAttributeValuesByNameAndType
Returns the list of string values (as a string array) of an attribute from the attribute list identified by its name and type. Name and type checking are done as string comparisons. If the type of an attribute is not defined (null) then it will ONLY match if the requested type is also null. Similarly if the requested type is null, only attributes with a null (undefined) type will be matched.- Parameters:
name
- name of attributetype
- type of attribute- Returns:
- string array of values of a matching attribute from the attribute list or null if no matching attribute
-
getAttributeValuesByName
Returns the list of string values (as a string array) of an attribute from the attribute list identified by its name only. If more than one attribute in the attribute list has the same name (and different types), the values of the first matching attribute will be returned.- Parameters:
name
- name of attribute- Returns:
- string array of values of a matching attribute from the attribute list or null if no matching attribute
-
setAttribute
Set the values of an attribute in the attribute list identified by name and type. If an existing attribute with that name and type already appears in the attribute list its values will be replaced otherwise a new attribute will be appended to the list.- Parameters:
name
- - name of attribute to update/addtype
- - type of attribute to update/addvalues
- - array of string values of attribute to update/add
-
getAttributeByNameAndType
Returns a reference to an attribute within the attribute list identified by its name and type. If the attribute is modified, it will be modified in the list. If no attribute with that name and type exists in the list, returns null.- Parameters:
name
- - name of attributetype
- - type of attribute- Returns:
- reference to the attribute in the list, or null if an attribute with that name and type cannot be located.
-
getAttributesByType
Returns an array of attributes from the list that match a given type. Each attribute is a reference so any modifications to attributes returned in the array will be reflected in the attribute list.- Parameters:
type
- type of attribute to match- Returns:
- an array of attributes that match the given type, or null if there are no attributes with that type in the list.
-
getAllAttributes
Gets all attributes in the attribute list.- Returns:
- a list of attributes
-
toString
String representation of the attribute list useful for debug tracing.
-