Package org.eclipse.hono.cache
Class BasicExpiringValue<T>
- java.lang.Object
-
- org.eclipse.hono.cache.BasicExpiringValue<T>
-
- Type Parameters:
T
- The value type.
- All Implemented Interfaces:
ExpiringValue<T>
public class BasicExpiringValue<T> extends Object implements ExpiringValue<T>
A base class for implementing an expiring value.
-
-
Constructor Summary
Constructors Constructor Description BasicExpiringValue(T value, Instant expirationTime)
Creates a new instance for a value and an expiration time.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
getValue()
Gets the value.boolean
isExpired()
Checks if the value has already expired.boolean
isExpired(Instant now)
Checks if the value has already expired.
-
-
-
Method Detail
-
getValue
public final T getValue()
Description copied from interface:ExpiringValue
Gets the value.- Specified by:
getValue
in interfaceExpiringValue<T>
- Returns:
- The value.
-
isExpired
public boolean isExpired()
Description copied from interface:ExpiringValue
Checks if the value has already expired.- Specified by:
isExpired
in interfaceExpiringValue<T>
- Returns:
true
if the value has expired based on the current system time,false
otherwise.
-
isExpired
public boolean isExpired(Instant now)
Description copied from interface:ExpiringValue
Checks if the value has already expired.- Specified by:
isExpired
in interfaceExpiringValue<T>
- Parameters:
now
- The reference point in time to check expiration against.- Returns:
true
if the value has expired based on the given instant,false
otherwise.
-
-