Class FieldUtils
java.lang.Object
io.deephaven.engine.table.impl.util.FieldUtils
Utilities for manipulating object fields.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <FIELD_TYPE,
INSTANCE_TYPE>
FIELD_TYPEensureField
(INSTANCE_TYPE instance, @NotNull AtomicReferenceFieldUpdater<INSTANCE_TYPE, FIELD_TYPE> updater, FIELD_TYPE defaultValue, @NotNull Supplier<FIELD_TYPE> valueFactory) Ensure a field is initialized exactly once, and get the current value after possibly initializing it.
-
Constructor Details
-
FieldUtils
public FieldUtils()
-
-
Method Details
-
ensureField
public static <FIELD_TYPE,INSTANCE_TYPE> FIELD_TYPE ensureField(INSTANCE_TYPE instance, @NotNull @NotNull AtomicReferenceFieldUpdater<INSTANCE_TYPE, FIELD_TYPE> updater, @Nullable FIELD_TYPE defaultValue, @NotNull @NotNull Supplier<FIELD_TYPE> valueFactory) Ensure a field is initialized exactly once, and get the current value after possibly initializing it.- Parameters:
instance
- The instance that owns the fieldupdater
- AnAtomicReferenceFieldUpdater
associated with the fielddefaultValue
- The reference value that signifies that the field has not been initializedvalueFactory
- A factory for new values; may be called concurrently by multiple threads as they race to initialize the field- Returns:
- The initialized value of the field
-