Class Attribute

java.lang.Object
com.ibm.oauth.core.api.attributes.Attribute

public class Attribute extends Object
An Attribute consists of an attribute by name, type and list of value(s). An attribute should be uniquely identified by its name and type. The name is considered as required.
  • Constructor Details

    • Attribute

      public Attribute(String name, String type, String[] values)
      Construct an attribute based on it's name, type and an array of values. Name should be non-null, type is optional and can be null. The values may be empty/null.
      Parameters:
      name - name of the attribute to construct
      type - type of attribute - typically a URN
      values - array of String values
    • Attribute

      public Attribute(String name, String type, String value)
      Construct an attribute based on it's name, type and a single string values. Name should be non-null, type is optional and can be null. The values may be empty/null.
      Parameters:
      name - name of the attribute to construct
      type - type of attribute - typically a URN
      value - single String value
  • Method Details

    • getName

      public String getName()
      Returns the name of the attribute
      Returns:
      name of attribute
    • getType

      public String getType()
      Returns the attribute type string. May be null if no type was specified
      Returns:
      type string for the attribute
    • getValues

      public List<String> getValues()
      The list of string values. This List is returned by reference so any modifications to the list also modify the attribute.
      Returns:
      reference to list of string values of the attribute. If the attribute has no values, an empty list is returned.
    • getValuesArray

      public String[] getValuesArray()
      The string values as an immutable array.
      Returns:
      array of string values of the attribute. If the attribute has no values, an empty array is returned.
    • getValue

      public String getValue()
      Returns the first string value for the attribute if any. If the list has no values, null is returned.
      Returns:
    • setValues

      public void setValues(String[] values)
      Resets the values of the attribute to the list of strings in the passed array. All existing values are removed.
      Parameters:
      values - new list of values for the attribute
    • toString

      public String toString()
      String representation of an attribute useful for debug tracing
      Overrides:
      toString in class Object