Interface CellDefinition<T>

Type Parameters:
T - the associated JDK type
All Known Subinterfaces:
BoolCellDefinition, BytesCellDefinition, CharCellDefinition, ComparableCellDefinition<T>, DoubleCellDefinition, IntCellDefinition, ListCellDefinition, LongCellDefinition, MapCellDefinition, StringCellDefinition
All Known Implementing Classes:
CellDefinition.Impl

public interface CellDefinition<T>
A {name, type} tuple that identifies a cell. Cells within a record must have definitions with unique names. Cells however are not considered related for the purposes of cell to cell comparison when performing computation operations unless the two cell definitions are identical in both name and type.
  • Method Details

    • name

      String name()
      Returns the name of this definition.
      Returns:
      definition name
    • type

      Type<T> type()
      Returns the type of this definition.
      Returns:
      definition type
    • newCell

      Cell<T> newCell(T value)
      Creates a new cell binding this definition to the given value.
      Parameters:
      value - value for the cell
      Returns:
      a cell
    • value

      Returns a function that extracts the value of this cell from a record.
      Returns:
      a cell extracting function
    • valueOr

      default BuildableFunction<CellCollection,T> valueOr(T otherwise)
      Returns a function that extracts the value of this cell from a record or uses the given default if the cell is absent.
      Parameters:
      otherwise - default value for absent cells
      Returns:
      a cell extracting function
    • valueOrFail

      default BuildableFunction<CellCollection,T> valueOrFail()
      Returns a function that extracts the value of this cell from a record or throws a NoSuchElementException if the cell is absent.
      Returns:
      a cell extracting function
    • exists

      Returns a predicate that tests for the presence of this cell on a record.
      Returns:
      a cell existence predicate
    • defineBool

      static BoolCellDefinition defineBool(String name)
      Returns a boolean cell definition with the given name.
      Parameters:
      name - cell definition name
      Returns:
      a boolean cell definition
    • defineChar

      static CharCellDefinition defineChar(String name)
      Returns a character cell definition with the given name.
      Parameters:
      name - cell definition name
      Returns:
      a character cell definition
    • defineInt

      static IntCellDefinition defineInt(String name)
      Returns an integer cell definition with the given name.
      Parameters:
      name - cell definition name
      Returns:
      an integer cell definition
    • defineLong

      static LongCellDefinition defineLong(String name)
      Returns a long cell definition with the given name.
      Parameters:
      name - cell definition name
      Returns:
      a long cell definition
    • defineDouble

      static DoubleCellDefinition defineDouble(String name)
      Returns a double cell definition with the given name.
      Parameters:
      name - cell definition name
      Returns:
      a double cell definition
    • defineString

      static StringCellDefinition defineString(String name)
      Returns a string cell definition with the given name.
      Parameters:
      name - cell definition name
      Returns:
      a string cell definition
    • defineBytes

      static BytesCellDefinition defineBytes(String name)
      Returns a byte array cell definition with the given name.
      Parameters:
      name - cell definition name
      Returns:
      a byte array cell definition
    • defineMap

      static MapCellDefinition defineMap(String name)
      Returns a map cell definition with the given name.
      Parameters:
      name - cell definition name
      Returns:
      a map cell definition
    • defineList

      static ListCellDefinition defineList(String name)
      Returns a list cell definition with the given name.
      Parameters:
      name - cell definition name
      Returns:
      a list cell definition
    • define

      static <T> CellDefinition<T> define(String name, Type<T> type)
      Returns a cell definition with the given type and name.
      Type Parameters:
      T - cell definition JDK type
      Parameters:
      name - cell definition name
      type - cell definition type
      Returns:
      a cell definition