Class DefaultValueStore

java.lang.Object
io.r2dbc.proxy.core.DefaultValueStore
All Implemented Interfaces:
ValueStore

public class DefaultValueStore extends Object implements ValueStore
Default implementation of ValueStore.

Simply uses Map as underlying storage. Primitive values will be autoboxed to corresponding wrapper values when they are stored.

Author:
Tadaya Tsuyukubo
  • Constructor Details

    • DefaultValueStore

      public DefaultValueStore()
  • Method Details

    • get

      public Object get(Object key)
      Description copied from interface: ValueStore
      Get the value associated to the key.
      Specified by:
      get in interface ValueStore
      Parameters:
      key - key
      Returns:
      value; can be null
    • get

      public <T> T get(Object key, Class<T> type)
      Description copied from interface: ValueStore
      Get the value associated to the key and cast to the type.
      Specified by:
      get in interface ValueStore
      Type Parameters:
      T - value type
      Parameters:
      key - key
      type - value type to cast
      Returns:
      value; can be null
    • getOrDefault

      public <T> T getOrDefault(Object key, T defaultValue)
      Description copied from interface: ValueStore
      Get the value associated to the key; otherwise returns specified value.
      Specified by:
      getOrDefault in interface ValueStore
      Type Parameters:
      T - value type
      Parameters:
      key - key
      defaultValue - default value
      Returns:
      value
    • put

      public void put(Object key, Object value)
      Description copied from interface: ValueStore
      Store a value associating the provided key.
      Specified by:
      put in interface ValueStore
      Parameters:
      key - key
      value - value
    • putAll

      public void putAll(Map<Object,Object> map)
      Description copied from interface: ValueStore
      Store all key value pairs from provided map.
      Specified by:
      putAll in interface ValueStore
      Parameters:
      map - map
    • remove

      public Object remove(Object key)
      Description copied from interface: ValueStore
      Remove the value associated to the provided key.
      Specified by:
      remove in interface ValueStore
      Parameters:
      key - key
      Returns:
      previously associated value or null if key did not exist