Package dev.orne.beans
Class BeanAnnotationFinder.WeakHashMapCache
java.lang.Object
dev.orne.beans.BeanAnnotationFinder.WeakHashMapCache
- All Implemented Interfaces:
BeanAnnotationFinder.Cache
- Enclosing class:
- BeanAnnotationFinder<T extends Annotation,
L extends Annotation>
@API(status=INTERNAL,
since="0.1")
protected static class BeanAnnotationFinder.WeakHashMapCache
extends Object
implements BeanAnnotationFinder.Cache
Implementation of
Cache
based on WeakHashMap
.- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(@NotNull BeanAnnotationFinder.CacheEntryKey<?> key) Returnstrue
if this instance contains an entry for the specified key.<T extends Annotation>
Set<T>get
(@NotNull BeanAnnotationFinder.CacheEntryKey<T> key) Returns the cached found annotations for the specified key, if any.<T extends Annotation>
voidput
(@NotNull BeanAnnotationFinder.CacheEntryKey<T> key, @NotNull Set<T> value) Puts the specified found annotations for the specified key.
-
Constructor Details
-
WeakHashMapCache
public WeakHashMapCache()Creates a new instance.
-
-
Method Details
-
contains
Returnstrue
if this instance contains an entry for the specified key.- Specified by:
contains
in interfaceBeanAnnotationFinder.Cache
- Parameters:
key
- The cache entry key- Returns:
- If this instance contains an entry for the key
-
put
@NotNull public <T extends Annotation> void put(@NotNull @NotNull BeanAnnotationFinder.CacheEntryKey<T> key, @NotNull @NotNull Set<T> value) Puts the specified found annotations for the specified key.- Specified by:
put
in interfaceBeanAnnotationFinder.Cache
- Type Parameters:
T
- The type of annotations- Parameters:
key
- The cache entry keyvalue
- The annotations found
-
get
public <T extends Annotation> Set<T> get(@NotNull @NotNull BeanAnnotationFinder.CacheEntryKey<T> key) Returns the cached found annotations for the specified key, if any.- Specified by:
get
in interfaceBeanAnnotationFinder.Cache
- Type Parameters:
T
- The type of annotations- Parameters:
key
- The cache entry key- Returns:
- The annotations found, or
null
if not cached o cache expired
-