Class RecordDeserializer<R extends Record>
java.lang.Object
dev.siroshun.configapi.core.serialization.record.RecordDeserializer<R>
- Type Parameters:
R
- the type of theRecord
- All Implemented Interfaces:
Deserializer<MapNode,
,R> Function<MapNode,
R>
@Experimental
public final class RecordDeserializer<R extends Record>
extends Object
implements Deserializer<MapNode,R>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
RecordDeserializer.Builder<R extends Record>
ARecordDeserializer.Builder
class forRecordDeserializer
. -
Method Summary
Modifier and TypeMethodDescriptionstatic <R extends Record>
@NotNull RecordDeserializer.Builder<R>Creates a newRecordDeserializer.Builder
of the specifiedRecord
class.static <R extends Record>
@NotNull RecordDeserializer.Builder<R>builder
(R defaultRecord) Creates a newRecordDeserializer.Builder
with the default record.static <R extends Record>
@NotNull RecordDeserializer<R>CreatesRecordDeserializer
of the specifiedRecord
class.static <R extends Record>
@NotNull RecordDeserializer<R>create
(@NotNull Class<? extends R> recordClass, @NotNull KeyGenerator keyGenerator) CreatesRecordDeserializer
of the specifiedRecord
class.static <R extends Record>
@NotNull RecordDeserializer<R>create
(R defaultRecord) CreatesRecordDeserializer
with the default record.static <R extends Record>
@NotNull RecordDeserializer<R>create
(R defaultRecord, @NotNull KeyGenerator keyGenerator) CreatesRecordDeserializer
with the default record.deserialize
(@NotNull MapNode input) Deserializes the object.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface dev.siroshun.configapi.core.serialization.Deserializer
andThen, apply, compose
-
Method Details
-
create
@Contract("_ -> new") @NotNull public static <R extends Record> @NotNull RecordDeserializer<R> create(@NotNull @NotNull Class<? extends R> recordClass) CreatesRecordDeserializer
of the specifiedRecord
class.- Type Parameters:
R
- the type of theRecord
- Parameters:
recordClass
- the class of theRecord
- Returns:
RecordDeserializer
of the specifiedRecord
class
-
create
@Contract("_, _ -> new") @NotNull public static <R extends Record> @NotNull RecordDeserializer<R> create(@NotNull @NotNull Class<? extends R> recordClass, @NotNull @NotNull KeyGenerator keyGenerator) CreatesRecordDeserializer
of the specifiedRecord
class.- Type Parameters:
R
- the type of theRecord
- Parameters:
recordClass
- the class of theRecord
keyGenerator
- theKeyGenerator
to generate keys from field names- Returns:
RecordDeserializer
of the specifiedRecord
class
-
create
@Contract("_ -> new") @NotNull public static <R extends Record> @NotNull RecordDeserializer<R> create(@NotNull R defaultRecord) CreatesRecordDeserializer
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:
RecordDeserializer
of the specifiedRecord
class
-
create
@Contract("_, _ -> new") @NotNull public static <R extends Record> @NotNull RecordDeserializer<R> create(@NotNull R defaultRecord, @NotNull @NotNull KeyGenerator keyGenerator) CreatesRecordDeserializer
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:
RecordDeserializer
of the specifiedRecord
class
-
builder
@Contract("_ -> new") @NotNull public static <R extends Record> @NotNull RecordDeserializer.Builder<R> builder(@NotNull @NotNull Class<? extends R> recordClass) Creates a newRecordDeserializer.Builder
of the specifiedRecord
class.- Type Parameters:
R
- the type of theRecord
- Parameters:
recordClass
- the class of theRecord
- Returns:
RecordDeserializer.Builder
of the specifiedRecord
class
-
builder
@Contract("_ -> new") @NotNull public static <R extends Record> @NotNull RecordDeserializer.Builder<R> builder(@NotNull R defaultRecord) Creates a newRecordDeserializer.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:
RecordDeserializer.Builder
of the specifiedRecord
class
-
deserialize
Deserializes the object.- Specified by:
deserialize
in interfaceDeserializer<MapNode,
R extends Record> - Parameters:
input
- the object to deserialize- Returns:
- the deserialized result
- Throws:
SerializationException
- ifDeserializer
for the custom objects is not found, etc
-