Class RecordSerialization<R extends Record>
java.lang.Object
dev.siroshun.configapi.core.serialization.record.RecordSerialization<R>
- Type Parameters:
R
- the type of theRecord
- All Implemented Interfaces:
Serialization<R,
MapNode>
@Experimental
public final class RecordSerialization<R extends Record>
extends Object
implements Serialization<R,MapNode>
A
Serialization
implementation for Record
class.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
RecordSerialization.Builder<R extends Record>
ARecordSerialization.Builder
class forRecordSerialization
. -
Method Summary
Modifier and TypeMethodDescriptionstatic <R extends Record>
@NotNull RecordSerialization.Builder<R>Creates a newRecordSerialization.Builder
of the specifiedRecord
class.static <R extends Record>
@NotNull RecordSerialization.Builder<R>builder
(R defaultRecord) Creates a newRecordSerialization.Builder
with the default record.static <R extends Record>
@NotNull RecordSerialization<R>Creates a newRecordSerialization
of the specifiedRecord
class.static <R extends Record>
@NotNull RecordSerialization<R>create
(@NotNull Class<? extends R> recordClass, @NotNull KeyGenerator keyGenerator) Creates a newRecordSerialization
of the specifiedRecord
class.static <R extends Record>
@NotNull RecordSerialization<R>create
(R defaultRecord) Creates a newRecordSerialization
with the default record.static <R extends Record>
@NotNull RecordSerialization<R>create
(R defaultRecord, @NotNull KeyGenerator keyGenerator) Creates a newRecordSerialization
with the default record.@NotNull RecordDeserializer<R>
GetsDeserializer
which thisSerialization
has.boolean
Checks if thisSerialization
hasDeserializer
.boolean
Checks if thisSerialization
hasSerializer
.@NotNull RecordSerializer<R>
GetsSerializer
which thisSerialization
has.
-
Method Details
-
create
@Contract("_ -> new") @NotNull public static <R extends Record> @NotNull RecordSerialization<R> create(@NotNull @NotNull Class<? extends R> recordClass) Creates a newRecordSerialization
of the specifiedRecord
class.- Type Parameters:
R
- the type of theRecord
- Parameters:
recordClass
- a class of theRecord
- Returns:
- a new
RecordSerialization
of the specifiedRecord
class
-
create
@Contract("_, _ -> new") @NotNull public static <R extends Record> @NotNull RecordSerialization<R> create(@NotNull @NotNull Class<? extends R> recordClass, @NotNull @NotNull KeyGenerator keyGenerator) Creates a newRecordSerialization
of the specifiedRecord
class.- Type Parameters:
R
- the type of theRecord
- Parameters:
recordClass
- a class of theRecord
keyGenerator
- theKeyGenerator
to generate keys from field names- Returns:
- a new
RecordSerialization
of the specifiedRecord
class
-
create
@Contract("_ -> new") @NotNull public static <R extends Record> @NotNull RecordSerialization<R> create(@NotNull R defaultRecord) Creates a newRecordSerialization
with the default record.- Type Parameters:
R
- the type of theRecord
- Parameters:
defaultRecord
- the defaultRecord
to get the default value if the value is not found in theMapNode
- Returns:
- a new
RecordSerialization
of the specifiedRecord
class
-
create
@Contract("_, _ -> new") @NotNull public static <R extends Record> @NotNull RecordSerialization<R> create(@NotNull R defaultRecord, @NotNull @NotNull KeyGenerator keyGenerator) Creates a newRecordSerialization
with the default record.- Type Parameters:
R
- the type of theRecord
- Parameters:
defaultRecord
- the defaultRecord
to get the default value if the value is not found in theMapNode
keyGenerator
- theKeyGenerator
to generate keys from field names- Returns:
- a new
RecordSerialization
of the specifiedRecord
class
-
builder
@Contract(value="_ -> new", pure=true) @NotNull public static <R extends Record> @NotNull RecordSerialization.Builder<R> builder(@NotNull @NotNull Class<? extends R> recordClass) Creates a newRecordSerialization.Builder
of the specifiedRecord
class.- Type Parameters:
R
- the type of theRecord
- Parameters:
recordClass
- a class of theRecord
- Returns:
- a new
RecordSerialization.Builder
ofRecordSerialization
for the specifiedRecord
class
-
builder
@Contract(value="_ -> new", pure=true) @NotNull public static <R extends Record> @NotNull RecordSerialization.Builder<R> builder(@NotNull R defaultRecord) Creates a newRecordSerialization.Builder
with the default record.- Type Parameters:
R
- the type of theRecord
- Parameters:
defaultRecord
- the defaultRecord
to get the default value if the value is not found in theMapNode
- Returns:
- a new
RecordSerialization.Builder
ofRecordSerialization
for the specifiedRecord
class
-
hasSerializer
public boolean hasSerializer()Description copied from interface:Serialization
Checks if thisSerialization
hasSerializer
.- Specified by:
hasSerializer
in interfaceSerialization<R extends Record,
MapNode> - Returns:
true
if thisSerialization
hasSerializer
, otherwisefalse
-
hasDeserializer
public boolean hasDeserializer()Description copied from interface:Serialization
Checks if thisSerialization
hasDeserializer
.- Specified by:
hasDeserializer
in interfaceSerialization<R extends Record,
MapNode> - Returns:
true
if thisSerialization
hasDeserializer
, otherwisefalse
-
serializer
Description copied from interface:Serialization
GetsSerializer
which thisSerialization
has.- Specified by:
serializer
in interfaceSerialization<R extends Record,
MapNode> - Returns:
Serializer
which thisSerialization
has
-
deserializer
Description copied from interface:Serialization
GetsDeserializer
which thisSerialization
has.- Specified by:
deserializer
in interfaceSerialization<R extends Record,
MapNode> - Returns:
Deserializer
which thisSerialization
has
-