Class Holder<E>

java.lang.Object
org.apache.calcite.util.Holder<E>
Type Parameters:
E - Element type

public class Holder<E> extends Object
A mutable slot that can contain one object.

A holder is useful for implementing OUT or IN-OUT parameters.

It is possible to sub-class to receive events on get or set.

  • Constructor Details

    • Holder

      protected Holder(E e)
      Creates a Holder containing a given value.

      Call this method from a derived constructor or via the of(E) method.

  • Method Details

    • set

      public void set(E e)
      Sets the value.
    • get

      public E get()
      Gets the value.
    • accept

      public Holder<E> accept(UnaryOperator<E> transform)
      Applies a transform to the value.
    • of

      public static <E> Holder<E> of(E e)
      Creates a holder containing a given value.
    • empty

      public static <E> Holder<@Nullable E> empty()
      Creates a holder containing null.