T
- the class implemented by the cache valuespublic final class XPFCacheResult<T> extends Object
isPresent()
will return true
and
get()
will return the value.Modifier and Type | Field and Description |
---|---|
private boolean |
present |
private T |
value |
Modifier | Constructor and Description |
---|---|
private |
XPFCacheResult() |
private |
XPFCacheResult(T value) |
Modifier and Type | Method and Description |
---|---|
static <T> XPFCacheResult<T> |
create(T value)
Creates wrapper for given value.
|
boolean |
equals(Object obj) |
T |
get()
If a value is present in this
CacheResult , returns the value,
otherwise throws NoSuchElementException . |
int |
hashCode() |
boolean |
isPresent()
Return
true if there is a value present, otherwise false . |
static <T> XPFCacheResult<T> |
notPresent()
Creates empty wrapper for absent result in the cache.
|
private T value
private final boolean present
private XPFCacheResult(T value)
private XPFCacheResult()
public static <T> XPFCacheResult<T> create(T value)
T
- the class implemented by the cache valuesvalue
- given value to create wrapperpublic static <T> XPFCacheResult<T> notPresent()
T
- the class implemented by the cache valuespublic T get()
CacheResult
, returns the value,
otherwise throws NoSuchElementException
.CacheResult
NoSuchElementException
- if there is no value presentpublic boolean isPresent()
true
if there is a value present, otherwise false
.true
if there is a value present, otherwise false
Copyright © 2022. All rights reserved.