Class AttrValueSupport


  • public class AttrValueSupport
    extends Object
    A helper class to make and convert an AttributeValue.
    • Constructor Detail

      • AttrValueSupport

        public AttrValueSupport()
    • Method Detail

      • make

        public static AttributeValue make​(Collection<?> objs,
                                          boolean trimValues)
        Creates an AttributeValue from the Collection of objects. The String representation each object is added as a value.
        Parameters:
        objs - The values of the returned AttributeValue.
        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 an AttributeMap by calling make(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 an AttributeMap by calling make(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 an AttributeMap by calling make(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 new AttributeMap with each of its AttributeValue updated with the appropriate mask setting.
        Parameters:
        srcMap - The source AttributeMap.
        maskedKeySet - A set of attribute names, whose values should be masked.
        maskOgnlValues - Whether or not the mask the Ognl values.
        Returns:
        A new AttributeMap with the appropriate masked flags.
      • checkSetMasked

        public static void checkSetMasked​(Map<String,​AttributeValue> attrMap,
                                          Set<String> maskedKeySet)
        Updates the specified AttributeMap by updating each masked flag depending on the maskedKeySet.
        Parameters:
        attrMap - The AttributeMap to 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.