Interface ReplicatedRegisterMap<K,V>

Type Parameters:
K - The type for keys.
V - The type for values.
All Superinterfaces:
kalix.replicatedentity.ReplicatedData

public interface ReplicatedRegisterMap<K,V> extends kalix.replicatedentity.ReplicatedData
A Map of registers. Uses ReplicatedRegister's as values.
  • Method Summary

    Modifier and Type
    Method
    Description
    Remove all mappings from this register map.
    boolean
    Check whether this register map contains a mapping for the given key.
    getValue(K key)
    Get the current value of the register at the given key.
    boolean
    Check whether this register map is empty.
    Get a Set view of the keys contained in this register map.
    remove(K key)
    Remove the mapping for a key if it is present.
    setValue(K key, V value)
    Set the current value of the register at the given key, using the default clock.
    setValue(K key, V value, ReplicatedRegister.Clock clock, long customClockValue)
    Set the current value of the register at the given key, using the given clock and custom clock value if required.
    int
    Get the number of key-register mappings in this register map.
  • Method Details

    • getValue

      Optional<V> getValue(K key)
      Get the current value of the register at the given key.
      Parameters:
      key - the key for the register
      Returns:
      the current value of the register, if it exists (as an Optional)
    • setValue

      default ReplicatedRegisterMap<K,V> setValue(K key, V value)
      Set the current value of the register at the given key, using the default clock.
      Parameters:
      key - the key for the register
      value - the new value of the register
      Returns:
      a new register map with the updated value
    • setValue

      ReplicatedRegisterMap<K,V> setValue(K key, V value, ReplicatedRegister.Clock clock, long customClockValue)
      Set the current value of the register at the given key, using the given clock and custom clock value if required.
      Parameters:
      key - the key for the register
      value - the new value of the register
      clock - the clock to use for replication
      customClockValue - the custom clock value to use, only if it's a custom clock
      Returns:
      a new register map with the updated value
    • remove

      ReplicatedRegisterMap<K,V> remove(K key)
      Remove the mapping for a key if it is present.
      Parameters:
      key - key whose mapping is to be removed from the map
      Returns:
      a new register map with the removed mapping
    • clear

      Remove all mappings from this register map.
      Returns:
      a new empty register map
    • size

      int size()
      Get the number of key-register mappings in this register map.
      Returns:
      the number of key-register mappings in this register map
    • isEmpty

      boolean isEmpty()
      Check whether this register map is empty.
      Returns:
      true if this register map contains no key-register mappings
    • containsKey

      boolean containsKey(K key)
      Check whether this register map contains a mapping for the given key.
      Parameters:
      key - key whose presence in this map is to be tested
      Returns:
      true if this register map contains a mapping for the given key
    • keySet

      Set<K> keySet()
      Get a Set view of the keys contained in this register map.
      Returns:
      the keys contained in this register map