Top Description Methods
com.fasterxml.jackson.databind.util

public Interface LookupCache<K, V>

Known Direct Implementers
com.fasterxml.jackson.databind.util.LRUMap
Imports
java.util.function.BiConsumer

An interface describing the required API for the Jackson-databind Type cache.

Note that while interface itself does not specify synchronization requirements for implementations, specific use cases do. Typically implementations are expected to be thread-safe, that is, to handle synchronization.

Since
2.12 (for forwards-compatiblity with 3.0)

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Method for removing all contents this cache has.

public default void
contents(BiConsumer<K, V>
Operation to apply on cache contents.
consumer
)

Method to apply operation on cache contents without exposing them.

public default LookupCache<K, V>
emptyCopy()

Method needed for creating clones but without contents.

public V

Returns:

value associated with key (can return null)
get
(Object key)

Note

key is of type Object only to retain binary backwards-compatibility

public V
put(K key, V value)

public V
putIfAbsent(K key, V value)

public int

Returns:

Number of entries currently in cache: may be approximate, only to be used for diagnostics, metrics reporting
size
()

Method Detail

clearback to summary
public void clear()

Method for removing all contents this cache has.

contentsback to summary
public default void contents(BiConsumer<K, V> consumer)

Method to apply operation on cache contents without exposing them.

Default implementation throws UnsupportedOperationException. Implementations are required to override this method.

Parameters
consumer:BiConsumer<K, V>

Operation to apply on cache contents.

Exceptions
UnsupportedOperationException:
if implementation does not override this method.
Since
2.16
emptyCopyback to summary
public default LookupCache<K, V> emptyCopy()

Method needed for creating clones but without contents.

Default implementation throws UnsupportedOperationException. Implementations are required to override this method.

Exceptions
UnsupportedOperationException:
if implementation does not override this method.
Since
2.16
getback to summary
public V get(Object key)

Note

key is of type Object only to retain binary backwards-compatibility

Returns:V

value associated with key (can return null)

putback to summary
public V put(K key, V value)
putIfAbsentback to summary
public V putIfAbsent(K key, V value)
sizeback to summary
public int size()
Returns:int

Number of entries currently in cache: may be approximate, only to be used for diagnostics, metrics reporting