public class PropertyValueConverterRegistrar<P extends PersistentProperty<P>> extends Object
PropertyValueConverter
with
a SimplePropertyValueConverterRegistry
that can be used in 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>>
Helper class used 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 class used to build up a fluent registration API starting with writing.
|
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 given type and property identified by
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)
converter
for the given type and property identified by
its name.type
- the domain type to obtain the property frompath
- the property name.converter
- the converter
to apply.public void registerConvertersIn(@NonNull ValueConverterRegistry<P> target)
converters
within the given
registry
.target
- ValueConverterRegistry
from which to register converters
;
must not be null.IllegalArgumentException
- if the ValueConverterRegistry
is null.ValueConverterRegistry
@NonNull public ValueConverterRegistry<P> buildRegistry()
SimplePropertyValueConverterRegistry
.SimplePropertyValueConverterRegistry
.Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.