T - type of the object being held by Transient@ThreadSafe public class Transient<T> extends Object implements Serializable
Serializable counterpart of Lazy| Modifier and Type | Method and Description |
|---|---|
void |
destroy(ThrowingConsumer<T> cleaner) |
static <T> Transient<T> |
eager(T value,
SerializableSupplier<T> initializer)
Creates instance of
Transient by eagerly setting it to provided value,
while given initializer will be used to re-instantiate the value after original
one being dropped during serialization/deserialization cycle |
T |
get() |
static <T> Transient<T> |
lazy(SerializableSupplier<T> initializer)
Creates instance of
Transient by lazily executing provided initializer,
to instantiate value of type T. |
void |
reset() |
public T get()
public void reset()
public void destroy(ThrowingConsumer<T> cleaner) throws Exception
Exceptionpublic static <T> Transient<T> lazy(SerializableSupplier<T> initializer)
Transient by lazily executing provided initializer,
to instantiate value of type T. Same initializer will be used to re-instantiate
the value after original one being dropped during serialization/deserialization cyclepublic static <T> Transient<T> eager(T value, SerializableSupplier<T> initializer)
Transient by eagerly setting it to provided value,
while given initializer will be used to re-instantiate the value after original
one being dropped during serialization/deserialization cycleCopyright © 2024 The Apache Software Foundation. All rights reserved.