Class AttrValueSupport
- java.lang.Object
-
- org.sourceid.saml20.adapter.attribute.AttrValueSupport
-
public class AttrValueSupport extends Object
A helper class to make and convert anAttributeValue.
-
-
Constructor Summary
Constructors Constructor Description AttrValueSupport()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcheckSetMasked(Map<String,AttributeValue> attrMap, Set<String> maskedKeySet)Updates the specifiedAttributeMapby updating each masked flag depending on the maskedKeySet.static AttributeMapconvert(Map<String,Object> srcMap, boolean maskAll)Converts the specified map to anAttributeMapby callingmake(Object)on each map value.static AttributeMapconvert(Map<String,Object> srcMap, boolean maskAll, boolean trim)Converts the specified map to anAttributeMapby callingmake(Object, boolean)on each map value.static AttributeMapconvert(Map<String,Object> srcMap, boolean maskAll, Set<String> maskedKeySet, boolean maskOgnlValues)static AttributeMapconvert(Map<String,Object> srcMap, Set<String> maskedKeySet, boolean maskOgnlValues)Converts the specified map to anAttributeMapby callingmake(Object, boolean)on each map value.static AttributeValuemake(Object obj)Creates anAttributeValuefrom the String representation of the specified object.static AttributeValuemake(Object obj, boolean trim)Creates anAttributeValuefrom the String representation of the specified object.static AttributeValuemake(Collection<?> objs)Creates anAttributeValuefrom the Collection of objects.static AttributeValuemake(Collection<?> objs, boolean trimValues)Creates anAttributeValuefrom the Collection of objects.static voidsetMasked(AttributeValue attributeValue)Helper method to set the specified attribute value's masked flag to true.static AttributeMapsetMasked(AttributeMap srcMap, Set<String> maskedKeySet, boolean maskOgnlValues)Returns a newAttributeMapwith each of itsAttributeValueupdated with the appropriate mask setting.
-
-
-
Method Detail
-
make
public static AttributeValue make(Object obj)
Creates anAttributeValuefrom the String representation of the specified object. The String representation is not trimmed.- Parameters:
obj- The value of the returnedAttributeValue.- Returns:
- A new
AttributeValueor obj if obj is an instance ofAttributeValue.
-
make
public static AttributeValue make(Object obj, boolean trim)
Creates anAttributeValuefrom the String representation of the specified object.- Parameters:
obj- The value of the returnedAttributeValue.trim- Whether the value should be trimmed.- Returns:
- A new
AttributeValueor obj if obj is an instance ofAttributeValue.
-
make
public static AttributeValue make(Collection<?> objs)
Creates anAttributeValuefrom the Collection of objects. The String representation each object is added as a value. The String representations are not trimmed.- Parameters:
objs- The values of the returnedAttributeValue.- Returns:
- A new
AttributeValue.
-
make
public static AttributeValue make(Collection<?> objs, boolean trimValues)
Creates anAttributeValuefrom the Collection of objects. The String representation each object is added as a value.- Parameters:
objs- The values of the returnedAttributeValue.trimValues- Whether the values should be trimmed.- Returns:
- A new
AttributeValue.
-
convert
public static AttributeMap convert(Map<String,Object> srcMap, boolean maskAll)
Converts the specified map to anAttributeMapby callingmake(Object)on each map value. Ognl values are not masked.- Parameters:
srcMap- The map to convert.maskAll- Whether all the values should be masked.- Returns:
- A new
AttributeMap.
-
convert
public static AttributeMap convert(Map<String,Object> srcMap, boolean maskAll, boolean trim)
Converts the specified map to anAttributeMapby callingmake(Object, boolean)on each map value. Ognl values are not masked.- Parameters:
srcMap- The map to convert.maskAll- Whether all the values should be masked.trim- Whether or not each value should be trimmed.- Returns:
- A new
AttributeMap.
-
convert
public static AttributeMap convert(Map<String,Object> srcMap, Set<String> maskedKeySet, boolean maskOgnlValues)
Converts the specified map to anAttributeMapby callingmake(Object, boolean)on each map value. Ognl values are not masked.- Parameters:
srcMap- The map to convert.maskedKeySet- A set of field names that should have their values masked.maskOgnlValues- Whether all the values should be masked.- Returns:
- A new
AttributeMap.
-
setMasked
public static AttributeMap setMasked(AttributeMap srcMap, Set<String> maskedKeySet, boolean maskOgnlValues)
Returns a newAttributeMapwith each of itsAttributeValueupdated with the appropriate mask setting.- Parameters:
srcMap- The sourceAttributeMap.maskedKeySet- A set of attribute names, whose values should be masked.maskOgnlValues- Whether or not the mask the Ognl values.- Returns:
- A new
AttributeMapwith the appropriate masked flags.
-
convert
public static AttributeMap convert(Map<String,Object> srcMap, boolean maskAll, Set<String> maskedKeySet, boolean maskOgnlValues)
-
checkSetMasked
public static void checkSetMasked(Map<String,AttributeValue> attrMap, Set<String> maskedKeySet)
Updates the specifiedAttributeMapby updating each masked flag depending on the maskedKeySet.- Parameters:
attrMap- TheAttributeMapto be updated.maskedKeySet- A set of attribute names, whose values should be masked. For any values not in this set the masked flag is cleared.
-
setMasked
public static void setMasked(AttributeValue attributeValue)
Helper method to set the specified attribute value's masked flag to true.- Parameters:
attributeValue- The attribute value to mask.
-
-