public abstract class LazyReference<T>
extends LockableObject
Soft reference with lazy initialization under lock
| Constructor and description |
|---|
LazyReference(ReferenceBundle bundle)Creates a lazily initialized reference that stores computed values using the supplied bundle. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
clear()Discards the cached state so the next get() call recomputes it. |
|
public T |
get()Returns the current value, initializing or recreating it when necessary. |
|
public abstract T |
initValue()Computes the value to cache for future get() calls. |
|
public String |
toString()Returns the current cached value as a string, or <null> when no value is available. |
| Methods inherited from class | Name |
|---|---|
class LockableObject |
isHeldExclusively, lock, tryAcquire, tryRelease, unlock |
Creates a lazily initialized reference that stores computed values using the supplied bundle.
bundle - the reference strategy to use after initializationDiscards the cached state so the next get() call recomputes it.
Returns the current value, initializing or recreating it when necessary.
nullComputes the value to cache for future get() calls.
null to cache a null result Returns the current cached value as a string, or <null> when no value is available.
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.