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
Cell
s.
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 class
A subset view of a cell collection. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault StoreMap
Return 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 CellCollection
subset
(CellDefinition<?>... definitions) Retrieve a subset of cells by their definitions.default CellCollection
subset
(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_NAME
The 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 anOptional
and returned. If this record contains no matching cell then an emptyOptional
is returned.- Type Parameters:
T
- the cell JDK type- Parameters:
cellDefinition
- cell to retrieve- Returns:
- An
Optional
with the cell value or an emptyOptional
if the record contains no matching cell - Throws:
NullPointerException
- ifcellDefinition
isnull
-
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 anOptional
and returned. If this record contains no matching cell then an emptyOptional
is returned.- Parameters:
name
- cell to retrieve- Returns:
- An
Optional
with the cell value or an emptyOptional
if the record contains no matching cell - Throws:
NullPointerException
- ifname
isnull
-
cell
Retrieve a cell by name. If this record contains a cell whose definition matches the supplied name then the cell is wrapped in anOptional
and returned. If this record contains no matching cell then an emptyOptional
is returned.- Parameters:
name
- cell to retrieve- Returns:
- An
Optional
with the cell or an emptyOptional
if the record contains no matching cell - Throws:
NullPointerException
- ifname
isnull
-
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
- ifdefinitions
or 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
- ifdefinitions
or 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