public class TypeCache<T>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
TypeCache.Builder<A> |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears complete cache.
|
static <A> TypeCache.Builder<A> |
create()
Creates a type cache by using a builder.
|
static <A> TypeCache<A> |
createDefault()
Creates default implementation of the type cache.
|
void |
forEachValue(java.util.function.Consumer<? super T> valueConsumer)
Iterates all cached values.
|
T |
get(java.lang.Class<?> key)
Returns value from the map or
null if value does not exist. |
<K> T |
get(java.lang.Class<K> key,
java.util.function.Function<java.lang.Class<K>,? extends T> mappingFunction)
Returns existing value or add default supplied one.
|
boolean |
isEmpty()
Returns
true if cache is empty. |
T |
put(java.lang.Class<?> type,
T value)
Add values to the map.
|
T |
remove(java.lang.Class<?> type)
Removes element from the type cache.
|
int |
size()
Returns cache size.
|
public static <A> TypeCache.Builder<A> create()
public static <A> TypeCache<A> createDefault()
public T get(java.lang.Class<?> key)
null
if value does not exist.public <K> T get(java.lang.Class<K> key, java.util.function.Function<java.lang.Class<K>,? extends T> mappingFunction)
get-nullcheck-put
block when
thread-safety is of importance.public T remove(java.lang.Class<?> type)
public void clear()
public int size()
public boolean isEmpty()
true
if cache is empty.public void forEachValue(java.util.function.Consumer<? super T> valueConsumer)
Copyright © 2003-present Jodd Team