org.sourceid.saml20.adapter.attribute
Class AttributeValue

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

public class AttributeValue
extends java.lang.Object
implements java.io.Serializable

A representation 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:
Serialized Form

Constructor Summary
AttributeValue(java.util.Collection<java.lang.String> values)
           
AttributeValue(java.lang.String value)
           
 
Method Summary
 java.lang.Iterable<? extends java.lang.Object> getAllObjectValues()
          Gets all the values for this attribute as raw objects.
 java.lang.Object getObjectValue()
          Gets the value of this attribute as a raw object.
 java.lang.String getValue()
          Gets the value of this attribute.
 java.lang.String getValue(java.lang.String nullMask)
          Gets the value of this attribute.
 java.lang.String getValueMaskNull()
          Gets the value of this attribute.
 java.lang.Iterable<java.lang.String> getValues()
          Gets all the values for this attribute.
 boolean hasValue(java.lang.String value)
          Determines if this attribute value has the indicated value.
 boolean isMasked()
          Has this attribute value been flagged as masked?
 boolean isMultiValue()
          Determines if this is a multi-valued attribute.
 java.lang.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.
 java.lang.String toString()
          If this is a single value attribute, this method returns that value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AttributeValue

public AttributeValue(java.util.Collection<java.lang.String> values)

AttributeValue

public AttributeValue(java.lang.String value)
Method Detail

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 java.lang.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 java.lang.String getValue(java.lang.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 java.lang.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 java.lang.Iterable<java.lang.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.

hasValue

public boolean hasValue(java.lang.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 java.lang.Iterable<? extends java.lang.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 java.lang.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 java.lang.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 java.lang.Object
Returns:
a string representation of this object.

sensitiveToString

public java.lang.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.


Copyright 2007 Ping Identity Corp. All rights reserved.