Interface DataStore
-
public interface DataStore
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
DataStore.Builder
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static DataStore.Builder
builder()
Returns theDataStore
builder.void
deserialize(DataManipulator.Mutable dataManipulator, DataView view)
Deserializes the data from theDataView
and puts it in theDataManipulator.Mutable
.default DataManipulator.Mutable
deserialize(DataView view)
Deserializes theDataView
as aDataManipulator.Mutable
.static <T,V extends Value<T>>
DataStoreof(Key<V> key, DataQuery dataQuery, io.leangen.geantyref.TypeToken<? extends DataHolder> typeToken, io.leangen.geantyref.TypeToken<? extends DataHolder>... typeTokens)
static <T,V extends Value<T>>
DataStoreof(Key<V> key, DataQuery dataQuery, java.lang.Class<? extends DataHolder> type, java.lang.Class<? extends DataHolder>... types)
default DataView
serialize(java.lang.Iterable<Value<?>> values)
Serializes theValue
s.default DataView
serialize(java.lang.Iterable<Value<?>> values, DataView view)
default DataView
serialize(DataManipulator dataManipulator)
Serializes the values of theDataManipulator
.DataView
serialize(DataManipulator dataManipulator, DataView view)
Serializes the values of theDataManipulator
into theDataView
.java.util.Collection<java.lang.reflect.Type>
supportedTypes()
Gets the supportedDataHolder
types.
-
-
-
Method Detail
-
supportedTypes
java.util.Collection<java.lang.reflect.Type> supportedTypes()
Gets the supportedDataHolder
types.Every returned
Type
will be a subtype ofDataHolder
.- Returns:
- The supported dataHolder type.
-
serialize
DataView serialize(DataManipulator dataManipulator, DataView view)
Serializes the values of theDataManipulator
into theDataView
.- Parameters:
dataManipulator
- The data manipulatorview
- The data view to serialize to- Returns:
- The view, for chaining
-
serialize
default DataView serialize(java.lang.Iterable<Value<?>> values, DataView view)
- Parameters:
values
- The values to serializeview
- The view- Returns:
- The view, for chaining
-
serialize
default DataView serialize(java.lang.Iterable<Value<?>> values)
Serializes theValue
s.- Parameters:
values
- The value container- Returns:
- This view, for chaining
-
serialize
default DataView serialize(DataManipulator dataManipulator)
Serializes the values of theDataManipulator
.- Parameters:
dataManipulator
- The data manipulator- Returns:
- This view, for chaining
-
deserialize
void deserialize(DataManipulator.Mutable dataManipulator, DataView view)
Deserializes the data from theDataView
and puts it in theDataManipulator.Mutable
.- Parameters:
dataManipulator
- The mutable data manipulatorview
- The data view to deserialize
-
deserialize
default DataManipulator.Mutable deserialize(DataView view)
Deserializes theDataView
as aDataManipulator.Mutable
.- Parameters:
view
- The data view to deserialize- Returns:
- The value store
-
of
@SafeVarargs static <T,V extends Value<T>> DataStore of(Key<V> key, DataQuery dataQuery, io.leangen.geantyref.TypeToken<? extends DataHolder> typeToken, io.leangen.geantyref.TypeToken<? extends DataHolder>... typeTokens)
Provides aDataStore
for a singleKey
.Note that default deserializers do not support
Collection
,Map
or Array types! UseDataStore.Builder.SerializersStep.key(Key, BiConsumer, Function)
for these.- Parameters:
key
- The data keydataQuery
- The dataQuery to serialize this key undertypeTokens
- The dataHolder types- Returns:
- The new data store
-
of
@SafeVarargs static <T,V extends Value<T>> DataStore of(Key<V> key, DataQuery dataQuery, java.lang.Class<? extends DataHolder> type, java.lang.Class<? extends DataHolder>... types)
Provides aDataStore
for a singleKey
.Note that default deserializers do not support
Collection
,Map
or Array types! UseDataStore.Builder.SerializersStep.key(Key, BiConsumer, Function)
for these.- Parameters:
key
- The data keydataQuery
- The dataQuery to serialize this key undertypes
- The dataHolder types- Returns:
- The new data store
-
builder
static DataStore.Builder builder()
Returns theDataStore
builder.- Returns:
- The dataStore builder.
-
-