Interface CellCollection

All Superinterfaces:
Collection<Cell<?>>, Iterable<Cell<?>>
All Known Subinterfaces:
KeyedCellCollection<K>, Record<K>
All Known Implementing Classes:
AbstractRecord, CellCollection.SubsetView, CellSet, KeyedCellCollection.Detached, KeyedCellCollection.SubsetView

public interface CellCollection extends Collection<Cell<?>>
A collection of Cells. The iteration order is not defined for a CellCollection but may be specified by an API method returning an instance.
  • Field Details

  • Method Details

    • get

      default <T> Optional<T> get(CellDefinition<T> cellDefinition)
      Retrieve a cell by CellDefinition. If this record contains a cell whose definition matches the supplied definition (in both name and type) then that cell's value is wrapped in an Optional and returned. If this record contains no matching cell then an empty Optional is returned.
      Type Parameters:
      T - the cell JDK type
      Parameters:
      cellDefinition - cell to retrieve
      Returns:
      An Optional with the cell value or an empty Optional if the record contains no matching cell
      Throws:
      NullPointerException - if cellDefinition is null
    • get

      default Optional<?> get(String name)
      Retrieve a cell by name. If this record contains a cell whose definition matches the supplied name then that cell's value is wrapped in an Optional and returned. If this record contains no matching cell then an empty Optional is returned.
      Parameters:
      name - cell to retrieve
      Returns:
      An Optional with the cell value or an empty Optional if the record contains no matching cell
      Throws:
      NullPointerException - if name is null
    • cell

      default Optional<Cell<?>> cell(String name)
      Retrieve a cell by name. If this record contains a cell whose definition matches the supplied name then the cell is wrapped in an Optional and returned. If this record contains no matching cell then an empty Optional is returned.
      Parameters:
      name - cell to retrieve
      Returns:
      An Optional with the cell or an empty Optional if the record contains no matching cell
      Throws:
      NullPointerException - if name is null
    • subset

      default CellCollection subset(Set<CellDefinition<?>> definitions)
      Retrieve a subset of cells by their definitions.

      The returned collection is a view. If this collection is mutable any mutations performed on this collection will be visible via the returned view.

      Parameters:
      definitions - cells to retrieve
      Returns:
      a view of a subset of this collection
      Throws:
      NullPointerException - if definitions or any of its contained values are null
    • subset

      default CellCollection subset(CellDefinition<?>... definitions)
      Retrieve a subset of cells by their definitions.
      Parameters:
      definitions - cells to retrieve
      Returns:
      a view of a subset of this collection
      Throws:
      NullPointerException - if definitions or any of its contained values are null
      See Also:
    • asStoreMap

      default StoreMap asStoreMap()
      Return this cell collection as a complex data type

      The JSON representation of a cell collection is:

      {
         "cells": {
           "cellName":"cellValue",
           ...
         }
       }
      Returns:
      keyed complex map