Class FieldUtils

java.lang.Object
io.deephaven.engine.table.impl.util.FieldUtils

public class FieldUtils extends Object
Utilities for manipulating object fields.
  • 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 field
      updater - An AtomicReferenceFieldUpdater associated with the field
      defaultValue - The reference value that signifies that the field has not been initialized
      valueFactory - 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