Class PrimaryKey


  • public class PrimaryKey
    extends Object
    Used to represent a primary key that has one or multiple key components.
    • Constructor Detail

      • PrimaryKey

        public PrimaryKey()
      • PrimaryKey

        public PrimaryKey​(KeyAttribute... components)
        Constructs with the specified key components.
      • PrimaryKey

        public PrimaryKey​(String hashKeyName,
                          Object hashKeyValue)
        Constructs with a hash key.
      • PrimaryKey

        public PrimaryKey​(String hashKeyName,
                          Object hashKeyValue,
                          String rangeKeyName,
                          Object rangeKeyValue)
        Constructs with a hash key and a range key.
    • Method Detail

      • getComponents

        public Collection<KeyAttribute> getComponents()
        Returns all the key components of this primary key.
      • getComponentNameSet

        public Set<String> getComponentNameSet()
        Returns all the key component names of this primary key as a set.
      • hasComponent

        public boolean hasComponent​(String attrName)
        Returns true if this primary has the specified key attribute name; false otherwise.
      • addComponents

        public PrimaryKey addComponents​(KeyAttribute... components)
        Add one or multiple key components to this primary key. Note adding a key component with the same name as that of an existing one would overwrite and become a single key component instead of two.
      • addComponent

        public PrimaryKey addComponent​(String keyAttributeName,
                                       Object keyAttributeValue)
        Add a key component to this primary key. Note adding a key component with the same name as that of an existing one would overwrite and become a single key component instead of two.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object