Package com.terracottatech.store
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
A collection of
Cells.
The iteration order is not defined for a CellCollection but may be specified
by an API method returning an instance.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classA subset view of a cell collection. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault StoreMapReturn this cell collection as a complex data typeRetrieve a cell by name.default <T> Optional<T>get(CellDefinition<T> cellDefinition) Retrieve a cell byCellDefinition.default Optional<?>Retrieve a cell by name.default CellCollectionsubset(CellDefinition<?>... definitions) Retrieve a subset of cells by their definitions.default CellCollectionsubset(Set<CellDefinition<?>> definitions) Retrieve a subset of cells by their definitions.
-
Field Details
-
CELLS_FIELD_NAME
The JSON/TSON field name for the cells.- See Also:
-
DEPRECATED_CELLS_FIELD_NAME
Deprecated.output now usesCELLS_FIELD_NAMEThe old JSON/TSON field name for the cells.- See Also:
-
-
Method Details
-
get
Retrieve a cell byCellDefinition. 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 anOptionaland returned. If this record contains no matching cell then an emptyOptionalis returned.- Type Parameters:
T- the cell JDK type- Parameters:
cellDefinition- cell to retrieve- Returns:
- An
Optionalwith the cell value or an emptyOptionalif the record contains no matching cell - Throws:
NullPointerException- ifcellDefinitionisnull
-
get
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 anOptionaland returned. If this record contains no matching cell then an emptyOptionalis returned.- Parameters:
name- cell to retrieve- Returns:
- An
Optionalwith the cell value or an emptyOptionalif the record contains no matching cell - Throws:
NullPointerException- ifnameisnull
-
cell
Retrieve a cell by name. If this record contains a cell whose definition matches the supplied name then the cell is wrapped in anOptionaland returned. If this record contains no matching cell then an emptyOptionalis returned.- Parameters:
name- cell to retrieve- Returns:
- An
Optionalwith the cell or an emptyOptionalif the record contains no matching cell - Throws:
NullPointerException- ifnameisnull
-
subset
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- ifdefinitionsor any of its contained values are null
-
subset
Retrieve a subset of cells by their definitions.- Parameters:
definitions- cells to retrieve- Returns:
- a view of a subset of this collection
- Throws:
NullPointerException- ifdefinitionsor any of its contained values are null- See Also:
-
asStoreMap
Return this cell collection as a complex data typeThe JSON representation of a cell collection is:
{ "cells": { "cellName":"cellValue", ... } }- Returns:
- keyed complex map
-
CELLS_FIELD_NAME