Package com.terracottatech.store
Interface TypedValue<T>
- Type Parameters:
T
- Type
- All Known Subinterfaces:
Cell<T>
- All Known Implementing Classes:
CellDefinition.CellImpl
,TypedValue.Impl
public interface TypedValue<T>
Core Type and value interface. Implemented by Cell, used as the value for
Maps and Lists. Consists of a
Type
and a value of that type. Also
assorted static builders.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionCreate a Cell from this value given a name.default Optional<byte[]>
ifBytes()
ifDouble()
ifList()
ifLong()
ifMap()
ifString()
default <TT> Optional<TT>
Return the value as an optional, if it matches the given type.default boolean
default boolean
isBytes()
default boolean
default boolean
isDouble()
default boolean
default boolean
isList()
default boolean
isLong()
default boolean
isMap()
default boolean
isString()
default boolean
Is this a specific typetype()
Returns the type of this value.static TypedValue<Boolean>
typedValue
(boolean i) static TypedValue<byte[]>
typedValue
(byte[] i) static TypedValue<Character>
typedValue
(char i) static TypedValue<Double>
typedValue
(double i) static TypedValue<Integer>
typedValue
(int i) static TypedValue<Long>
typedValue
(long i) static <TT> TypedValue<TT>
typedValue
(Cell<TT> cell) Extract a TypedValue from a Cell.static TypedValue<?>
static TypedValue<StoreMap>
static <I> TypedValue<I>
typedValue
(Type<I> typ, I value) Factory builder to create a TypedValue.static TypedValue<String>
typedValue
(String i) value()
Returns the value held in this TypedValue instance.
-
Method Details
-
type
Returns the type of this value.- Returns:
- definition type
-
value
T value()Returns the value held in this TypedValue instance.- Returns:
- the value
-
isBoolean
default boolean isBoolean() -
isCharacter
default boolean isCharacter() -
isInteger
default boolean isInteger() -
isLong
default boolean isLong() -
isDouble
default boolean isDouble() -
isString
default boolean isString() -
isBytes
default boolean isBytes() -
isList
default boolean isList() -
isMap
default boolean isMap() -
typedValue
Extract a TypedValue from a Cell.- Type Parameters:
TT
- the type of the cell.- Parameters:
cell
- the cell- Returns:
- the typed value
-
cellNamed
Create a Cell from this value given a name.- Parameters:
name
- the name- Returns:
- the cell
-
isType
Is this a specific type- Parameters:
typ
- the type in question- Returns:
- true if the type matches.
-
ifType
Return the value as an optional, if it matches the given type.- Type Parameters:
TT
- the type parameter- Parameters:
typ
- the type you are looking for- Returns:
- the optional of the value of the specific type or empty()
-
ifBoolean
-
ifCharacter
-
ifInteger
-
ifLong
-
ifDouble
-
ifString
-
ifBytes
-
ifList
-
ifMap
-
typedValue
Factory builder to create a TypedValue.- Type Parameters:
I
- the type parameter- Parameters:
typ
- the typevalue
- the value- Returns:
- the typed value
-
typedValue
-
typedValue
-
typedValue
-
typedValue
-
typedValue
-
typedValue
-
typedValue
-
typedValue
-
typedValue
-