be.ehealth.technicalconnector.utils

## Class ObservableSelfPopulatingMap<K,V>

- java.lang.Object
- - be.ehealth.technicalconnector.utils.ObservableSelfPopulatingMap<K,V>

- All Implemented Interfaces:
    Map<K,V>

      public class ObservableSelfPopulatingMap<K,V>
      extends Object
      implements Map<K,V>

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface java.util.Map

      `Map.Entry<K,V>`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ObservableSelfPopulatingMap(Map<K,V> delegate, BiPredicate<K,V> beforePutValidator, BiConsumer<K,V> onPutAction, Function<K,V> onGetPopulatorAction)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()`
    `V` | `compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction)` Same approach as computeIfAbsent: validate inside the remapping function so that a rejection prevents the value from ever reaching the delegate.
    `V` | `computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction)` Validation happens before the value is written to the delegate by wrapping the mapping function so we can intercept the produced value first.
    `boolean` | `containsKey(Object key)`
    `boolean` | `containsValue(Object value)`
    `Set<Map.Entry<K,V>>` | `entrySet()`
    `V` | `get(Object key)` If a populator was provided and the key is missing, produces a value, stores it (triggering validation + notification), and returns it.
    `boolean` | `isEmpty()`
    `Set<K>` | `keySet()`
    `V` | `merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction)`
    `V` | `put(K key, V value)`
    `void` | `putAll(Map<? extends K,? extends V> map)`
    `V` | `putIfAbsent(K key, V value)`
    `V` | `remove(Object key)`
    `int` | `size()`
    `Collection<V>` | `values()`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.util.Map

      `computeIfPresent, equals, forEach, getOrDefault, hashCode, remove, replace, replace, replaceAll`

- - ### Constructor Detail

    - #### ObservableSelfPopulatingMap

          public ObservableSelfPopulatingMap(Map<K,V> delegate,
                                             BiPredicate<K,V> beforePutValidator,
                                             BiConsumer<K,V> onPutAction,
                                             Function<K,V> onGetPopulatorAction)

  - ### Method Detail

    - #### put

          public V put(K key,
                       V value)

      Specified by:
        `put` in interface `Map<K,V>`

    - #### putAll

          public void putAll(Map<? extends K,? extends V> map)

      Specified by:
        `putAll` in interface `Map<K,V>`

    - #### putIfAbsent

          public V putIfAbsent(K key,
                               V value)

      Specified by:
        `putIfAbsent` in interface `Map<K,V>`

    - #### computeIfAbsent

          public V computeIfAbsent(K key,
                                   Function<? super K,? extends V> mappingFunction)

      Validation happens before the value is written to the delegate by wrapping the mapping function so we can intercept the produced value first.
      Specified by:
        `computeIfAbsent` in interface `Map<K,V>`

    - #### compute

          public V compute(K key,
                           BiFunction<? super K,? super V,? extends V> remappingFunction)

      Same approach as computeIfAbsent: validate inside the remapping function so that a rejection prevents the value from ever reaching the delegate.
      Specified by:
        `compute` in interface `Map<K,V>`

    - #### merge

          public V merge(K key,
                         V value,
                         BiFunction<? super V,? super V,? extends V> remappingFunction)

      Specified by:
        `merge` in interface `Map<K,V>`

    - #### get

          public V get(Object key)

      If a populator was provided and the key is missing, produces a value, stores it (triggering validation + notification), and returns it.
      Specified by:
        `get` in interface `Map<K,V>`

    - #### containsKey

          public boolean containsKey(Object key)

      Specified by:
        `containsKey` in interface `Map<K,V>`

    - #### size

          public int size()

      Specified by:
        `size` in interface `Map<K,V>`

    - #### isEmpty

          public boolean isEmpty()

      Specified by:
        `isEmpty` in interface `Map<K,V>`

    - #### containsValue

          public boolean containsValue(Object value)

      Specified by:
        `containsValue` in interface `Map<K,V>`

    - #### remove

          public V remove(Object key)

      Specified by:
        `remove` in interface `Map<K,V>`

    - #### clear

          public void clear()

      Specified by:
        `clear` in interface `Map<K,V>`

    - #### keySet

          public Set<K> keySet()

      Specified by:
        `keySet` in interface `Map<K,V>`

    - #### values

          public Collection<V> values()

      Specified by:
        `values` in interface `Map<K,V>`

    - #### entrySet

          public Set<Map.Entry<K,V>> entrySet()

      Specified by:
        `entrySet` in interface `Map<K,V>`

Connector Packaging PERSDIETICIAN 4.9.5 API
Copyright © {inceptionYear}-2026 eHealth. All Rights Reserved.