@Incubating
public class ReevaluatingReference<T>
extends Object
This class represents a reference to the most actual incarnation of a Metaclass. INTERNAL USE ONLY.
| Constructor and description |
|---|
ReevaluatingReference(Class clazz, Supplier<T> valueSupplier, Function<T, SwitchPoint> validationSupplier)Stores the suppliers and a weak reference to clazz, then loads the
first payload. |
Stores the suppliers and a weak reference to clazz, then loads the
first payload. valueSupplier supplies it and validationSupplier
supplies the SwitchPoint that guards the cached handle. Invalidating
that switch point makes the next getPayload() load a replacement.
clazz - payload class passed to MethodHandles.constant; held only weaklyvalueSupplier - supplies a payload, including the one loaded nowvalidationSupplier - supplies the switch point for a payload Returns the payload from the guarded handle. When the switch point has been
invalidated, the fallback loads a new payload, installs a new guarded handle,
and returns that payload. A payload may be null when the supplier
returns null. Any throwable from the handle is rethrown unchecked.
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.