Class RecordSerialization.Builder<R extends Record>
java.lang.Object
dev.siroshun.configapi.core.serialization.record.RecordSerialization.Builder<R>
- Type Parameters:
R
- the type of theRecord
- Enclosing class:
- RecordSerialization<R extends Record>
A
RecordSerialization.Builder
class for RecordSerialization
.-
Method Summary
Modifier and TypeMethodDescription<T> @NotNull RecordSerialization.Builder<R>
addDeserializer
(@NotNull Class<T> clazz, @NotNull Deserializer<? super Node<?>, ? extends T> deserializer) Adds aDeserializer
for the specifiesClass
.@NotNull RecordSerialization.Builder<R>
addDeserializers
(@NotNull DeserializerRegistry<Node<?>> registry) AddsDeserializer
s in theDeserializerRegistry
.@NotNull RecordSerialization.Builder<R>
addSerialization
(@NotNull SerializationRegistry<Node<?>> registry) AddsSerialization
s in theSerializationRegistry
.<T> @NotNull RecordSerialization.Builder<R>
addSerialization
(@NotNull Class<T> clazz, @NotNull Serialization<? super T, ? extends Node<?>> serialization) Adds aSerialization
for the specifiesClass
.<T> @NotNull RecordSerialization.Builder<R>
addSerializer
(@NotNull Class<T> clazz, @NotNull Serializer<? super T, ? extends Node<?>> serializer) Adds aSerializer
for the specifiesClass
.@NotNull RecordSerialization.Builder<R>
addSerializers
(@NotNull SerializerRegistry<Node<?>> registry) AddsSerializer
s in theSerializerRegistry
.@NotNull RecordSerialization<R>
build()
CreatesRecordSerialization
from thisRecordSerialization.Builder
.@NotNull RecordSerialization.Builder<R>
defaultRecord
(R defaultRecord) Sets the defaultRecord
.@NotNull RecordSerialization.Builder<R>
keyGenerator
(@NotNull KeyGenerator keyGenerator) Sets theKeyGenerator
.
-
Method Details
-
addSerializer
@Contract("_, _ -> this") @NotNull public <T> @NotNull RecordSerialization.Builder<R> addSerializer(@NotNull @NotNull Class<T> clazz, @NotNull @NotNull Serializer<? super T, ? extends Node<?>> serializer) Adds aSerializer
for the specifiesClass
.- Type Parameters:
T
- a type of objects to serialize- Parameters:
clazz
- a type of objects to serializeserializer
- aSerializer
- Returns:
- this
RecordSerialization.Builder
instance
-
addSerializers
@Contract("_ -> this") @NotNull public @NotNull RecordSerialization.Builder<R> addSerializers(@NotNull @NotNull SerializerRegistry<Node<?>> registry) AddsSerializer
s in theSerializerRegistry
.- Parameters:
registry
- aSerializerRegistry
that containsSerializer
s to register- Returns:
- this
RecordSerialization.Builder
instance
-
addDeserializer
@Contract("_, _ -> this") @NotNull public <T> @NotNull RecordSerialization.Builder<R> addDeserializer(@NotNull @NotNull Class<T> clazz, @NotNull @NotNull Deserializer<? super Node<?>, ? extends T> deserializer) Adds aDeserializer
for the specifiesClass
.- Type Parameters:
T
- a type of objects after deserialization- Parameters:
clazz
- a type of objects after deserializationdeserializer
- aDeserializer
- Returns:
- this
RecordSerialization.Builder
instance
-
addDeserializers
@Contract("_ -> this") @NotNull public @NotNull RecordSerialization.Builder<R> addDeserializers(@NotNull @NotNull DeserializerRegistry<Node<?>> registry) AddsDeserializer
s in theDeserializerRegistry
.- Parameters:
registry
- aDeserializerRegistry
that containsDeserializer
s to register- Returns:
- this
RecordSerialization.Builder
instance
-
addSerialization
@Contract("_, _ -> this") @NotNull public <T> @NotNull RecordSerialization.Builder<R> addSerialization(@NotNull @NotNull Class<T> clazz, @NotNull @NotNull Serialization<? super T, ? extends Node<?>> serialization) Adds aSerialization
for the specifiesClass
.- Type Parameters:
T
- a type of objects of theSerialization
- Parameters:
clazz
- a type of objects of theSerialization
serialization
- aSerialization
- Returns:
- this
RecordSerialization.Builder
instance
-
addSerialization
@Contract("_ -> this") @NotNull public @NotNull RecordSerialization.Builder<R> addSerialization(@NotNull @NotNull SerializationRegistry<Node<?>> registry) AddsSerialization
s in theSerializationRegistry
.- Parameters:
registry
- aSerializationRegistry
that containsSerialization
s to register- Returns:
- this
RecordSerialization.Builder
instance
-
keyGenerator
@Contract("_ -> this") @NotNull public @NotNull RecordSerialization.Builder<R> keyGenerator(@NotNull @NotNull KeyGenerator keyGenerator) Sets theKeyGenerator
.- Parameters:
keyGenerator
- theKeyGenerator
to generate keys- Returns:
- this
RecordSerialization.Builder
instance
-
defaultRecord
@Contract("_ -> this") @NotNull public @NotNull RecordSerialization.Builder<R> defaultRecord(@NotNull R defaultRecord) Sets the defaultRecord
.- Parameters:
defaultRecord
- the defaultRecord
- Returns:
- this
RecordSerialization.Builder
instance
-
build
CreatesRecordSerialization
from thisRecordSerialization.Builder
.- Returns:
- a new
RecordSerialization
-