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 aDeserializerfor the specifiesClass.@NotNull RecordSerialization.Builder<R>addDeserializers(@NotNull DeserializerRegistry<Node<?>> registry) AddsDeserializers in theDeserializerRegistry.@NotNull RecordSerialization.Builder<R>addSerialization(@NotNull SerializationRegistry<Node<?>> registry) AddsSerializations in theSerializationRegistry.<T> @NotNull RecordSerialization.Builder<R>addSerialization(@NotNull Class<T> clazz, @NotNull Serialization<? super T, ? extends Node<?>> serialization) Adds aSerializationfor the specifiesClass.<T> @NotNull RecordSerialization.Builder<R>addSerializer(@NotNull Class<T> clazz, @NotNull Serializer<? super T, ? extends Node<?>> serializer) Adds aSerializerfor the specifiesClass.@NotNull RecordSerialization.Builder<R>addSerializers(@NotNull SerializerRegistry<Node<?>> registry) AddsSerializers in theSerializerRegistry.@NotNull RecordSerialization<R>build()CreatesRecordSerializationfrom 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 aSerializerfor the specifiesClass.- Type Parameters:
T- a type of objects to serialize- Parameters:
clazz- a type of objects to serializeserializer- aSerializer- Returns:
- this
RecordSerialization.Builderinstance
-
addSerializers
@Contract("_ -> this") @NotNull public @NotNull RecordSerialization.Builder<R> addSerializers(@NotNull @NotNull SerializerRegistry<Node<?>> registry) AddsSerializers in theSerializerRegistry.- Parameters:
registry- aSerializerRegistrythat containsSerializers to register- Returns:
- this
RecordSerialization.Builderinstance
-
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 aDeserializerfor the specifiesClass.- Type Parameters:
T- a type of objects after deserialization- Parameters:
clazz- a type of objects after deserializationdeserializer- aDeserializer- Returns:
- this
RecordSerialization.Builderinstance
-
addDeserializers
@Contract("_ -> this") @NotNull public @NotNull RecordSerialization.Builder<R> addDeserializers(@NotNull @NotNull DeserializerRegistry<Node<?>> registry) AddsDeserializers in theDeserializerRegistry.- Parameters:
registry- aDeserializerRegistrythat containsDeserializers to register- Returns:
- this
RecordSerialization.Builderinstance
-
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 aSerializationfor the specifiesClass.- Type Parameters:
T- a type of objects of theSerialization- Parameters:
clazz- a type of objects of theSerializationserialization- aSerialization- Returns:
- this
RecordSerialization.Builderinstance
-
addSerialization
@Contract("_ -> this") @NotNull public @NotNull RecordSerialization.Builder<R> addSerialization(@NotNull @NotNull SerializationRegistry<Node<?>> registry) AddsSerializations in theSerializationRegistry.- Parameters:
registry- aSerializationRegistrythat containsSerializations to register- Returns:
- this
RecordSerialization.Builderinstance
-
keyGenerator
@Contract("_ -> this") @NotNull public @NotNull RecordSerialization.Builder<R> keyGenerator(@NotNull @NotNull KeyGenerator keyGenerator) Sets theKeyGenerator.- Parameters:
keyGenerator- theKeyGeneratorto generate keys- Returns:
- this
RecordSerialization.Builderinstance
-
defaultRecord
@Contract("_ -> this") @NotNull public @NotNull RecordSerialization.Builder<R> defaultRecord(@NotNull R defaultRecord) Sets the defaultRecord.- Parameters:
defaultRecord- the defaultRecord- Returns:
- this
RecordSerialization.Builderinstance
-
build
CreatesRecordSerializationfrom thisRecordSerialization.Builder.- Returns:
- a new
RecordSerialization
-