Class RecordSerializer<R extends Record>
java.lang.Object
dev.siroshun.configapi.serialization.record.RecordSerializer<R>
- Type Parameters:
R
- the type of theRecord
- All Implemented Interfaces:
dev.siroshun.serialization.core.Serializer<R,
,MapNode> Function<R,
MapNode>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
RecordSerializer.Builder<R extends Record>
ARecordSerializer.Builder
class forRecordSerializer
. -
Method Summary
Modifier and TypeMethodDescriptionstatic <R extends Record>
@NotNull RecordSerializer.Builder<R> builder()
Creates a newRecordSerializer.Builder
ofRecordSerializer
.static <R extends Record>
@NotNull RecordSerializer<R> create
(@NotNull dev.siroshun.serialization.core.key.KeyGenerator keyGenerator) Creates aRecordSerializer
with theKeyGenerator
.@NotNull MapNode
@NotNull MapNode
serializeDefault
(@NotNull Class<? extends R> clazz) Creates a defaultMapNode
from the given record class.static <R extends Record>
@NotNull RecordSerializer<R> Gets the defaultRecordSerializer
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.siroshun.serialization.core.Serializer
andThen, apply, compose
-
Method Details
-
serializer
Gets the defaultRecordSerializer
.This serializer uses
KeyGenerator.AS_IS
.- Type Parameters:
R
- the type of theRecord
- Returns:
- the default
RecordSerializer
-
create
@NotNull public static <R extends Record> @NotNull RecordSerializer<R> create(@NotNull @NotNull dev.siroshun.serialization.core.key.KeyGenerator keyGenerator) Creates aRecordSerializer
with theKeyGenerator
.If specifying
KeyGenerator.AS_IS
, this method returnsserializer()
.- Type Parameters:
R
- the type of theRecord
- Parameters:
keyGenerator
- theKeyGenerator
to generate key name- Returns:
- the
RecordSerializer
-
builder
Creates a newRecordSerializer.Builder
ofRecordSerializer
.- Type Parameters:
R
- the type of theRecord
- Returns:
- a new
RecordSerializer.Builder
ofRecordSerializer
-
serialize
-
serializeDefault
@NotNull public @NotNull MapNode serializeDefault(@NotNull @NotNull Class<? extends R> clazz) throws dev.siroshun.serialization.core.SerializationException Creates a defaultMapNode
from the given record class.
-