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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AttributeValue()AttributeValue(String value)AttributeValue(Collection<String> values)AttributeValue(Collection<String> strVals, Collection<?> objVals)AttributeValue(AttributeValue copyFrom)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterable<? extends Object>getAllObjectValues()Gets all the values for this attribute as raw objects.ObjectgetObjectValue()Gets the value of this attribute as a raw object.StringgetValue()Gets the value of this attribute.StringgetValue(boolean enforceMasking)Gets the value of this attribute.StringgetValue(String nullMask)Gets the value of this attribute.StringgetValueMaskNull()Gets the value of this attribute.Iterable<String>getValues()Gets all the values for this attribute.Collection<String>getValuesAsCollection()Gets all the values for this attribute.HashSet<String>getValuesAsHashSet()Returns the values as aHashSet.booleanhasValue(String value)Determines if this attribute value has the indicated value.booleanisMasked()Has this attribute value been flagged as masked?booleanisMultiValue()Determines if this is a multi-valued attribute.StringsensitiveToString()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.voidsetMasked(boolean masked)Set whether or not this AttributeValue should be masked.StringtoString()If this is a single value attribute, this method returns that value.
-
-
-
Constructor Detail
-
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 Detail
-
isMultiValue
public boolean isMultiValue()
Determines if this is a multi-valued attribute. Returns true ifgetValues()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 Collectionthat 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.
-
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.
-
-