Package org.springframework.data.convert
Interface ConverterBuilder
- All Known Subinterfaces:
ConverterBuilder.ConverterAware
,ConverterBuilder.ReadingConverterBuilder<T,
,S> ConverterBuilder.WritingConverterBuilder<S,
T>
public interface ConverterBuilder
API to easily set up
GenericConverter
instances using Java 8 lambdas, mostly in bidirectional fashion for
easy registration as custom type converters of the Spring Data mapping subsystem. The registration starts either with
the definition of a reading or writing converter that can then be completed.- Since:
- 2.0
- Author:
- Oliver Gierke
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
AConverterBuilder
aware of both a reading and writing converter.static interface
Exposes a reading converter.static interface
Interface to represent an intermediate setup step ofConverterBuilder.ConverterAware
defining a reading converter first.static interface
Exposes a writing converter.static interface
Interface to represent an intermediate setup step ofConverterBuilder.ConverterAware
defining a writing converter first. -
Method Summary
Modifier and TypeMethodDescriptionReturns allGenericConverter
instances to be registered for the currentConverterBuilder
.static <S,
T> ConverterBuilder.ReadingConverterBuilder<S, T> Creates a newConverterBuilder.ReadingConverterBuilder
to produce a converter to read values of the given source (the store type) into the given target (the domain type).static <S,
T> ConverterBuilder.WritingConverterBuilder<S, T> Creates a newConverterBuilder.WritingConverterBuilder
to produce a converter to write values of the given source (the domain type) into the given target (the store type).
-
Method Details
-
reading
static <S,T> ConverterBuilder.ReadingConverterBuilder<S,T> reading(Class<S> source, Class<T> target, Function<? super S, ? extends T> function) Creates a newConverterBuilder.ReadingConverterBuilder
to produce a converter to read values of the given source (the store type) into the given target (the domain type).- Parameters:
source
- must not be null.target
- must not be null.function
- must not be null.- Returns:
-
writing
static <S,T> ConverterBuilder.WritingConverterBuilder<S,T> writing(Class<S> source, Class<T> target, Function<? super S, ? extends T> function) Creates a newConverterBuilder.WritingConverterBuilder
to produce a converter to write values of the given source (the domain type) into the given target (the store type).- Parameters:
source
- must not be null.target
- must not be null.function
- must not be null.- Returns:
-
getConverters
Set<GenericConverter> getConverters()Returns allGenericConverter
instances to be registered for the currentConverterBuilder
.- Returns:
-