Class CouchbasePropertyValueConverterFactory
java.lang.Object
org.springframework.data.couchbase.core.convert.CouchbasePropertyValueConverterFactory
- All Implemented Interfaces:
PropertyValueConverterFactory
public class CouchbasePropertyValueConverterFactory
extends Object
implements PropertyValueConverterFactory
Accept the Couchbase @Encrypted and @JsonValue annotations in addition to @ValueConverter annotation.
There can only be one propertyValueConverter for a property. Although there maybe be multiple annotations, getConverter(property) only returns one converter (a ChainedPropertyValueConverter might be useful). Note that valueConversions.afterPropertiesSet() (see
There can only be one propertyValueConverter for a property. Although there maybe be multiple annotations, getConverter(property) only returns one converter (a ChainedPropertyValueConverter might be useful). Note that valueConversions.afterPropertiesSet() (see
AbstractCouchbaseConfiguration.customConversions(CryptoManager, ObjectMapper)
encapsulates this in a CachingPropertyValueConverterFactory which caches by 'property'. Although
CachingPropertyValueConverterFactory does have the functionality to cache by a type, it only caches by the type
specified on an @ValueConverter annotation.To avoid having identical converter instances for each instance of a class
containing an @JsonValue annotation, converterCacheForType is used.- Author:
- Michael Reiche
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Map<Class<?>,Optional<PropertyValueConverter<?, ?, ?>>> -
Constructor Summary
ConstructorsConstructorDescriptionCouchbasePropertyValueConverterFactory(com.couchbase.client.core.encryption.CryptoManager cryptoManager, Map<Class<? extends Annotation>, Class<?>> annotationToConverterMap, com.fasterxml.jackson.databind.ObjectMapper objectMapper) -
Method Summary
Modifier and TypeMethodDescription<DV,SV, P extends ValueConversionContext<?>>
PropertyValueConverter<DV,SV, P> getConverter(Class<? extends PropertyValueConverter<DV, SV, P>> converterType) <DV,SV, P extends ValueConversionContext<?>>
PropertyValueConverter<DV,SV, P> getConverter(Class<? extends PropertyValueConverter<DV, SV, P>> converterType, PersistentProperty<?> property) <DV,SV, P extends ValueConversionContext<?>>
PropertyValueConverter<DV,SV, P> getConverter(PersistentProperty<?> property)
-
Field Details
-
converterCacheForType
-
-
Constructor Details
-
CouchbasePropertyValueConverterFactory
public CouchbasePropertyValueConverterFactory(com.couchbase.client.core.encryption.CryptoManager cryptoManager, Map<Class<? extends Annotation>, Class<?>> annotationToConverterMap, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-
Method Details
-
getConverter
public <DV,SV, PropertyValueConverter<DV,P extends ValueConversionContext<?>> SV, getConverterP> (PersistentProperty<?> property) - Specified by:
getConverterin interfacePropertyValueConverterFactory- Type Parameters:
DV- destination valueSV- source valueP- context- Parameters:
property- must not be null.- Returns:
-
getConverter
public <DV,SV, PropertyValueConverter<DV,P extends ValueConversionContext<?>> SV, getConverterP> (Class<? extends PropertyValueConverter<DV, SV, P>> converterType) - Specified by:
getConverterin interfacePropertyValueConverterFactory
-
getConverter
public <DV,SV, PropertyValueConverter<DV,P extends ValueConversionContext<?>> SV, getConverterP> (Class<? extends PropertyValueConverter<DV, SV, P>> converterType, PersistentProperty<?> property) - Type Parameters:
DV-SV-P-- Parameters:
converterType-property-- Returns:
-