public class PropertyValueConverterRegistrar<P extends PersistentProperty<P>> extends Object
PropertyValueConverter
with a SimplePropertyValueConverterRegistry
that can be used with PropertyValueConversions
.
It is possible to register type safe converters via registerConverter(Class, Function)
registrar.registerConverter(Person.class, Person::getName) // .writing(StringConverter::encrypt) // .reading(StringConverter::decrypt);
Modifier and Type | Class and Description |
---|---|
static class |
PropertyValueConverterRegistrar.ReadingConverterRegistrationBuilder<T,S,R,P extends PersistentProperty<P>>
A helper to build a fluent API to register how to read a database value into a domain object property.
|
static class |
PropertyValueConverterRegistrar.WritingConverterRegistrationBuilder<T,S,P extends PersistentProperty<P>>
Helper to build up a fluent registration API starting on
|
Constructor and Description |
---|
PropertyValueConverterRegistrar() |
Modifier and Type | Method and Description |
---|---|
ValueConverterRegistry<P> |
buildRegistry()
Obtain the
SimplePropertyValueConverterRegistry . |
PropertyValueConverterRegistrar<P> |
registerConverter(Class<?> type,
String path,
PropertyValueConverter<?,?,? extends ValueConversionContext<?>> converter)
Register the given converter for the types property identified via its name.
|
<T,S> PropertyValueConverterRegistrar.WritingConverterRegistrationBuilder<T,S,P> |
registerConverter(Class<T> type,
Function<T,S> property)
Starts a converter registration by pointing to a property of a domain type.
|
<T,S> PropertyValueConverterRegistrar.WritingConverterRegistrationBuilder<T,S,P> |
registerConverter(Class<T> type,
String propertyName,
Class<S> propertyType)
Starts a converter registration by pointing to a property of a domain type.
|
void |
registerConvertersIn(ValueConverterRegistry<P> target)
Register collected
converters within the given registry . |
public <T,S> PropertyValueConverterRegistrar.WritingConverterRegistrationBuilder<T,S,P> registerConverter(Class<T> type, Function<T,S> property)
T
- the domain typeS
- the property typetype
- the domain type to obtain the property fromproperty
- a function to describe the property to be referenced. Usually a method handle to a getter.public <T,S> PropertyValueConverterRegistrar.WritingConverterRegistrationBuilder<T,S,P> registerConverter(Class<T> type, String propertyName, Class<S> propertyType)
T
- the domain typeS
- the property typetype
- the domain type to obtain the property frompropertyName
- a function to describe the property to be referenced. Usually a method handle to a getter.public PropertyValueConverterRegistrar<P> registerConverter(Class<?> type, String path, PropertyValueConverter<?,?,? extends ValueConversionContext<?>> converter)
type
- the domain type to obtain the property frompath
- the property name.converter
- the converter to apply.public ValueConverterRegistry<P> buildRegistry()
SimplePropertyValueConverterRegistry
.SimplePropertyValueConverterRegistry
.public void registerConvertersIn(ValueConverterRegistry<P> target)
converters
within the given registry
.Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.