Class AttributeValue

java.lang.Object
org.sourceid.saml20.adapter.attribute.AttributeValue
All Implemented Interfaces:
Serializable

public class AttributeValue extends Object implements Serializable
A representation of the value(s) of an attribute. This class is intended to allow for multi-valued attributes yet still enable simple usage of single-valued attributes.
See Also:
  • Constructor Details

    • AttributeValue

      public AttributeValue()
    • AttributeValue

      public AttributeValue(Collection<String> values)
    • AttributeValue

      public AttributeValue(String value)
    • AttributeValue

      public AttributeValue(Collection<String> strVals, Collection<?> objVals)
    • AttributeValue

      public AttributeValue(AttributeValue copyFrom)
  • Method Details

    • isMultiValue

      public boolean isMultiValue()
      Determines if this is a multi-valued attribute. Returns true if getValues() would return an Iterable having more than one item.
      Returns:
      True if this is a multi-valued attribute, false otherwise.
    • getValue

      public String getValue()
      Gets the value of this attribute. If this is a multi-valued attribute, the first value will be returned. Note that this method can return null.
      Returns:
      The first value of this attribute value or null is there is no value.
    • getValue

      public String getValue(boolean enforceMasking)
      Gets the value of this attribute. If this is a multi-valued attribute, the first value will be returned. Note that this method can return null.
      Returns:
      The first value of this attribute value or null is there is no value.
    • getValue

      public String getValue(String nullMask)
      Gets the value of this attribute. If this is a multi-valued attribute, the first value will be returned. If there is no value for the attribute the nullMask parameter will be returned.
      Parameters:
      nullMask -
      Returns:
      The first value of this attribute value or nullMask is there is no value.
    • getValueMaskNull

      public String getValueMaskNull()
      Gets the value of this attribute. If this is a multi-valued attribute, the first value will be returned. If there is no value for the attribute an empty string will be returned.
      Returns:
      The first value of this attribute value or an empty string is there is no value.
    • getValues

      public Iterable<String> getValues()
      Gets all the values for this attribute. This method will never return null but may return an Iterable that is empty.
      Returns:
      An all the values of this attribute as an Iterable of Strings.
    • getValuesAsCollection

      public Collection<String> getValuesAsCollection()
      Gets all the values for this attribute. This method will never return null but may return a Collection that is empty.
      Returns:
      An all the values of this attribute as a Collection of Strings.
    • hasValue

      public boolean hasValue(String value)
      Determines if this attribute value has the indicated value.
      Parameters:
      value - the value of interest.
      Returns:
      True if any of the values for this attribute match the given parameter, false otherwise.
    • getAllObjectValues

      public Iterable<? extends Object> getAllObjectValues()
      Gets all the values for this attribute as raw objects. This method will never return null but may return an Iterable that is empty.
      Returns:
      An all the values of this attribute as an Iterable.
    • getObjectValue

      public Object getObjectValue()
      Gets the value of this attribute as a raw object. If this is a multi-valued attribute, the first value will be returned. Note that this method can return null.
      Returns:
      The first value of this attribute value or null is there is no value.
    • toString

      public String toString()
      If this is a single value attribute, this method returns that value. If it is a multi-valued attribute, a string representing all values [value1, value2, value3] is returned.
      Overrides:
      toString in class Object
      Returns:
      A string representation of this object.
    • sensitiveToString

      public String sensitiveToString()
      If this is considered a 'masked' attribute (because it contains sensitive user info), the actual value of the attribute will be concealed with this method only.
    • isMasked

      public boolean isMasked()
      Has this attribute value been flagged as masked?
      Returns:
      True if this is considered a sensitive attribute value that should not be logged.
    • setMasked

      public void setMasked(boolean masked)
      Set whether or not this AttributeValue should be masked.
      Parameters:
      masked - Whether or not this AttributeValue should be masked.
    • getValuesAsHashSet

      public HashSet<String> getValuesAsHashSet()
      Returns the values as a HashSet.
      Returns:
      The values as a HashSet.