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 classRecordSerialization.Builder<R extends Record>ARecordSerialization.Builderclass forRecordSerialization. -
Method Summary
Modifier and TypeMethodDescriptionstatic <R extends Record>
@NotNull RecordSerialization.Builder<R>Creates a newRecordSerialization.Builderof the specifiedRecordclass.static <R extends Record>
@NotNull RecordSerialization.Builder<R>builder(R defaultRecord) Creates a newRecordSerialization.Builderwith the default record.static <R extends Record>
@NotNull RecordSerialization<R>Creates a newRecordSerializationof the specifiedRecordclass.static <R extends Record>
@NotNull RecordSerialization<R>create(@NotNull Class<? extends R> recordClass, @NotNull KeyGenerator keyGenerator) Creates a newRecordSerializationof the specifiedRecordclass.static <R extends Record>
@NotNull RecordSerialization<R>create(R defaultRecord) Creates a newRecordSerializationwith the default record.static <R extends Record>
@NotNull RecordSerialization<R>create(R defaultRecord, @NotNull KeyGenerator keyGenerator) Creates a newRecordSerializationwith the default record.@NotNull RecordDeserializer<R>GetsDeserializerwhich thisSerializationhas.booleanChecks if thisSerializationhasDeserializer.booleanChecks if thisSerializationhasSerializer.@NotNull RecordSerializer<R>GetsSerializerwhich thisSerializationhas.
-
Method Details
-
create
@Contract("_ -> new") @NotNull public static <R extends Record> @NotNull RecordSerialization<R> create(@NotNull @NotNull Class<? extends R> recordClass) Creates a newRecordSerializationof the specifiedRecordclass.- Type Parameters:
R- the type of theRecord- Parameters:
recordClass- a class of theRecord- Returns:
- a new
RecordSerializationof the specifiedRecordclass
-
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 newRecordSerializationof the specifiedRecordclass.- Type Parameters:
R- the type of theRecord- Parameters:
recordClass- a class of theRecordkeyGenerator- theKeyGeneratorto generate keys from field names- Returns:
- a new
RecordSerializationof the specifiedRecordclass
-
create
@Contract("_ -> new") @NotNull public static <R extends Record> @NotNull RecordSerialization<R> create(@NotNull R defaultRecord) Creates a newRecordSerializationwith the default record.- Type Parameters:
R- the type of theRecord- Parameters:
defaultRecord- the defaultRecordto get the default value if the value is not found in theMapNode- Returns:
- a new
RecordSerializationof the specifiedRecordclass
-
create
@Contract("_, _ -> new") @NotNull public static <R extends Record> @NotNull RecordSerialization<R> create(@NotNull R defaultRecord, @NotNull @NotNull KeyGenerator keyGenerator) Creates a newRecordSerializationwith the default record.- Type Parameters:
R- the type of theRecord- Parameters:
defaultRecord- the defaultRecordto get the default value if the value is not found in theMapNodekeyGenerator- theKeyGeneratorto generate keys from field names- Returns:
- a new
RecordSerializationof the specifiedRecordclass
-
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.Builderof the specifiedRecordclass.- Type Parameters:
R- the type of theRecord- Parameters:
recordClass- a class of theRecord- Returns:
- a new
RecordSerialization.BuilderofRecordSerializationfor the specifiedRecordclass
-
builder
@Contract(value="_ -> new", pure=true) @NotNull public static <R extends Record> @NotNull RecordSerialization.Builder<R> builder(@NotNull R defaultRecord) Creates a newRecordSerialization.Builderwith the default record.- Type Parameters:
R- the type of theRecord- Parameters:
defaultRecord- the defaultRecordto get the default value if the value is not found in theMapNode- Returns:
- a new
RecordSerialization.BuilderofRecordSerializationfor the specifiedRecordclass
-
hasSerializer
public boolean hasSerializer()Description copied from interface:SerializationChecks if thisSerializationhasSerializer.- Specified by:
hasSerializerin interfaceSerialization<R extends Record,MapNode> - Returns:
trueif thisSerializationhasSerializer, otherwisefalse
-
hasDeserializer
public boolean hasDeserializer()Description copied from interface:SerializationChecks if thisSerializationhasDeserializer.- Specified by:
hasDeserializerin interfaceSerialization<R extends Record,MapNode> - Returns:
trueif thisSerializationhasDeserializer, otherwisefalse
-
serializer
Description copied from interface:SerializationGetsSerializerwhich thisSerializationhas.- Specified by:
serializerin interfaceSerialization<R extends Record,MapNode> - Returns:
Serializerwhich thisSerializationhas
-
deserializer
Description copied from interface:SerializationGetsDeserializerwhich thisSerializationhas.- Specified by:
deserializerin interfaceSerialization<R extends Record,MapNode> - Returns:
Deserializerwhich thisSerializationhas
-