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 Summary

    Constructors 
    Modifier Constructor Description
    protected Holder​(E e)
    Creates a Holder containing a given value.
  • Method Summary

    Modifier and Type Method Description
    E get()
    Gets the value.
    static <E> Holder<E> of​(E e)
    Creates a holder containing a given value.
    void set​(E e)
    Sets the value.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.
    • of

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