Class TupleBackedMap

java.lang.Object
org.springframework.data.jpa.util.TupleBackedMap
All Implemented Interfaces:
Map<String,Object>

public class TupleBackedMap extends Object implements Map<String,Object>
A Map implementation which delegates all calls to a Tuple. Depending on the provided Tuple implementation it might return the same value for various keys of which only one will appear in the key/entry set.
Since:
4.0
Author:
Jens Schauder
  • Constructor Details

    • TupleBackedMap

      public TupleBackedMap(jakarta.persistence.Tuple tuple)
  • Method Details

    • underscoreAware

      public static jakarta.persistence.Tuple underscoreAware(jakarta.persistence.Tuple delegate)
      Creates a underscore-aware Tuple wrapper applying JdbcUtils.convertPropertyNameToUnderscoreName(java.lang.String) conversion to leniently look up properties from query results whose columns follow snake-case syntax.
      Parameters:
      delegate - the tuple to wrap.
      Returns:
    • size

      public int size()
      Specified by:
      size in interface Map<String,Object>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Map<String,Object>
    • containsKey

      public boolean containsKey(Object key)
      If the key is not a String or not a key of the backing Tuple this returns false. Otherwise this returns true even when the value from the backing Tuple is null.
      Specified by:
      containsKey in interface Map<String,Object>
      Parameters:
      key - the key for which to get the value from the map.
      Returns:
      whether the key is an element of the backing tuple.
    • containsValue

      public boolean containsValue(Object value)
      Specified by:
      containsValue in interface Map<String,Object>
    • get

      public @Nullable Object get(Object key)
      If the key is not a String or not a key of the backing Tuple this returns null. Otherwise the value from the backing Tuple is returned, which also might be null.
      Specified by:
      get in interface Map<String,Object>
      Parameters:
      key - the key for which to get the value from the map.
      Returns:
      the value of the backing Tuple for that key or null.
    • put

      public Object put(String key, Object value)
      Specified by:
      put in interface Map<String,Object>
    • remove

      public Object remove(Object key)
      Specified by:
      remove in interface Map<String,Object>
    • putAll

      public void putAll(Map<? extends String,?> m)
      Specified by:
      putAll in interface Map<String,Object>
    • clear

      public void clear()
      Specified by:
      clear in interface Map<String,Object>
    • keySet

      public Set<String> keySet()
      Specified by:
      keySet in interface Map<String,Object>
    • values

      public Collection<Object> values()
      Specified by:
      values in interface Map<String,Object>
    • entrySet

      public Set<Map.Entry<String,Object>> entrySet()
      Specified by:
      entrySet in interface Map<String,Object>