Class Attributes

  • All Implemented Interfaces:
    Map<String,​com.amazonaws.services.dynamodbv2.model.AttributeValue>

    @Immutable
    @Loggable(1)
    public final class Attributes
    extends Object
    implements Map<String,​com.amazonaws.services.dynamodbv2.model.AttributeValue>
    DynamoDB item attributes.

    It's a convenient immutable builder of a map of attribute values for DynamoDB put operation. Use it like this:

    Map<String, AttributeValue> attributes = new Attributes()
       .with("hash", "some value")
       .with("range", 12345);
     
    Since:
    0.1
    • Constructor Detail

      • Attributes

        public Attributes()
        Private ctor.
      • Attributes

        public Attributes​(Map<String,​com.amazonaws.services.dynamodbv2.model.AttributeValue> map)
        Private ctor.
        Parameters:
        map - Map of them
    • Method Detail

      • with

        public Attributes with​(String name,
                               com.amazonaws.services.dynamodbv2.model.AttributeValue value)
        With this attribute.
        Parameters:
        name - Attribute name
        value - The value
        Returns:
        Attributes
      • with

        public Attributes with​(Map<String,​com.amazonaws.services.dynamodbv2.model.AttributeValue> map)
        With these attributes.
        Parameters:
        map - Attributes to add
        Returns:
        Attributes
      • asKeys

        public Map<String,​com.amazonaws.services.dynamodbv2.model.ExpectedAttributeValue> asKeys()
        Convert them to a map of expected values.
        Returns:
        Expected values
      • with

        public Attributes with​(String name,
                               Long value)
        With this attribute.
        Parameters:
        name - Attribute name
        value - The value
        Returns:
        Attributes
      • with

        public Attributes with​(String name,
                               Integer value)
        With this attribute.
        Parameters:
        name - Attribute name
        value - The value
        Returns:
        Attributes
      • with

        public Attributes with​(String name,
                               Object value)
        With this attribute.
        Parameters:
        name - Attribute name
        value - The value
        Returns:
        Attributes
      • only

        public Attributes only​(Iterable<String> keys)
        Filter out all keys except provided ones.
        Parameters:
        keys - Keys to leave in the map
        Returns:
        Attributes
      • size

        public int size()
        Specified by:
        size in interface Map<String,​com.amazonaws.services.dynamodbv2.model.AttributeValue>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface Map<String,​com.amazonaws.services.dynamodbv2.model.AttributeValue>
      • containsKey

        public boolean containsKey​(Object key)
        Specified by:
        containsKey in interface Map<String,​com.amazonaws.services.dynamodbv2.model.AttributeValue>
      • containsValue

        public boolean containsValue​(Object value)
        Specified by:
        containsValue in interface Map<String,​com.amazonaws.services.dynamodbv2.model.AttributeValue>
      • get

        public com.amazonaws.services.dynamodbv2.model.AttributeValue get​(Object key)
        Specified by:
        get in interface Map<String,​com.amazonaws.services.dynamodbv2.model.AttributeValue>
      • keySet

        public Set<String> keySet()
        Specified by:
        keySet in interface Map<String,​com.amazonaws.services.dynamodbv2.model.AttributeValue>
      • values

        public Collection<com.amazonaws.services.dynamodbv2.model.AttributeValue> values()
        Specified by:
        values in interface Map<String,​com.amazonaws.services.dynamodbv2.model.AttributeValue>
      • entrySet

        public Set<Map.Entry<String,​com.amazonaws.services.dynamodbv2.model.AttributeValue>> entrySet()
        Specified by:
        entrySet in interface Map<String,​com.amazonaws.services.dynamodbv2.model.AttributeValue>
      • put

        public com.amazonaws.services.dynamodbv2.model.AttributeValue put​(String key,
                                                                          com.amazonaws.services.dynamodbv2.model.AttributeValue value)
        Specified by:
        put in interface Map<String,​com.amazonaws.services.dynamodbv2.model.AttributeValue>
      • remove

        public com.amazonaws.services.dynamodbv2.model.AttributeValue remove​(Object key)
        Specified by:
        remove in interface Map<String,​com.amazonaws.services.dynamodbv2.model.AttributeValue>
      • putAll

        public void putAll​(Map<? extends String,​? extends com.amazonaws.services.dynamodbv2.model.AttributeValue> map)
        Specified by:
        putAll in interface Map<String,​com.amazonaws.services.dynamodbv2.model.AttributeValue>
      • clear

        public void clear()
        Specified by:
        clear in interface Map<String,​com.amazonaws.services.dynamodbv2.model.AttributeValue>