Package com.terracottatech.store
Interface Record<K extends Comparable<K>>
- Type Parameters:
K
- the key type for the record
- All Superinterfaces:
CellCollection
,Collection<Cell<?>>
,Iterable<Cell<?>>
,KeyedCellCollection<K>
- All Known Implementing Classes:
AbstractRecord
A record is a set of
Cell
s associated with a key. The set of cells
forming a record are unique in name. Records are immutable and are the
largest atomically modifiable data structure within a dataset. Naturally
records should therefore correspond to the natural aggregate or atomic data
unit within an application.
The iteration order over Cell
s in a Record
is undefined.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.terracottatech.store.KeyedCellCollection
KeyedCellCollection.Detached<K extends Comparable<K>>, KeyedCellCollection.SubsetView<K extends Comparable<K>>
-
Field Summary
Fields inherited from interface com.terracottatech.store.CellCollection
CELLS_FIELD_NAME, DEPRECATED_CELLS_FIELD_NAME
Fields inherited from interface com.terracottatech.store.KeyedCellCollection
DEPRECATED_KEY_FIELD_NAME, KEY_FIELD_NAME
-
Method Summary
Modifier and TypeMethodDescriptionstatic Function<Record<?>,
Stream<CellDefinition<?>>> Returns a function that extracts aStream
of cell definitions from a record.static <K extends Comparable<K>>
Record<K>emptyRecord
(K key) Deprecated.boolean
Indicates whether this record is equal to another object.findFunction
(String dotSpec) default BuildablePredicate<? super Record<K>>
Returns a predicate that tests if anotherRecord
instance is the same as this one.static <K extends Comparable<K>>
BuildableComparableFunction<KeyedCellCollection<K>,K> Returns a function that, given a record, gives the key.static BuildableFunction<Record<?>,
Set<CellDefinition<?>>> schema()
Returns a function that extracts aSet
of cell definitions from a record.Methods inherited from interface com.terracottatech.store.CellCollection
cell, get, get
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toArray
Methods inherited from interface com.terracottatech.store.KeyedCellCollection
asStoreMap, getKey, hashCode, subset, subset
-
Method Details
-
getEqualsPredicate
Returns a predicate that tests if anotherRecord
instance is the same as this one.- Returns:
- a predicate that tests if another
Record
instance is the same as this one.
-
equals
Indicates whether this record is equal to another object.A record is equal to:
- the ABA-safe same record from the same dataset
- a record from a different dataset with the same contents
- a keyed-cell collection that is not a record and has the same contents
- Specified by:
equals
in interfaceCollection<K extends Comparable<K>>
- Specified by:
equals
in interfaceKeyedCellCollection<K extends Comparable<K>>
- Overrides:
equals
in classObject
- Parameters:
o
- object to be compared for equality with this record- Returns:
true
if the specified object is equal to this record- See Also:
-
keyFunction
static <K extends Comparable<K>> BuildableComparableFunction<KeyedCellCollection<K>,K> keyFunction()Returns a function that, given a record, gives the key.- Type Parameters:
K
- the key type for the record- Returns:
- a function that, given a record, gives the key.
-
definitions
Returns a function that extracts aStream
of cell definitions from a record.- Returns:
- a function that, extracts a stream of cell definitions from a record
-
schema
Returns a function that extracts aSet
of cell definitions from a record.- Returns:
- a function that, extracts a set of cell definitions from a record
-
findFunction
-
emptyRecord
Deprecated.in favor ofKeyedCellCollection.of(Comparable, Cell[])
Returns an empty record instance for the given key.- Type Parameters:
K
- key type- Parameters:
key
- record key- Returns:
- an empty record
-
KeyedCellCollection.of(Comparable, Cell[])