Class LazyCalculatedProperty<V>
java.lang.Object
ch.nolix.base.datastructure.property.LazyCalculatedProperty<V>
- Type Parameters:
V- is the type of the value of aLazyCalculatedProperty.
- All Implemented Interfaces:
ILazyCalculatedProperty<V>, UpToDateRequestable
- Author:
- Silvan Wyss
-
Method Summary
Modifier and TypeMethodDescriptionstatic <V2> LazyCalculatedProperty<V2> forValueCreater(Supplier<V2> valueCreator) static <V2> LazyCalculatedProperty<V2> forValueCreaterAndNeedToUpdateSupplier(Supplier<V2> valueCreator, BooleanSupplier needToUpdateSupplier) booleanMethods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface UpToDateRequestable
isOutOfDate
-
Method Details
-
forValueCreaterAndNeedToUpdateSupplier
public static <V2> LazyCalculatedProperty<V2> forValueCreaterAndNeedToUpdateSupplier(Supplier<V2> valueCreator, BooleanSupplier needToUpdateSupplier) - Type Parameters:
V2- is the type of the value of the createdLazyCalculatedProperty.- Parameters:
valueCreator-needToUpdateSupplier-- Returns:
- a new
LazyCalculatedPropertywith the given valueCreator and needToUpdateSupplier. - Throws:
RuntimeException- if the given valueCreator is null.RuntimeException- if the given needToUpdateSupplier is null.
-
forValueCreater
- Type Parameters:
V2- is the type of the value of the createdLazyCalculatedProperty.- Parameters:
valueCreator-- Returns:
- a new
LazyCalculatedPropertywith the given valueCreator. - Throws:
RuntimeException- if the given valueCreator is null.
-
getStoredValue
- Specified by:
getStoredValuein interfaceILazyCalculatedProperty<V>- Returns:
- the lazy calculated value of the current
ILazyCalculatedProperty.
-
isUpToDate
public boolean isUpToDate()- Specified by:
isUpToDatein interfaceUpToDateRequestable- Returns:
- true if the current
UpToDateRequestableis up-to-date, false otherwise.
-