Class AbstractCouchbaseConverter
java.lang.Object
org.springframework.data.couchbase.core.convert.AbstractCouchbaseConverter
- All Implemented Interfaces:
InitializingBean,EntityConverter<CouchbasePersistentEntity<?>,,CouchbasePersistentProperty, Object, CouchbaseDocument> EntityReader<Object,,CouchbaseDocument> EntityWriter<Object,,CouchbaseDocument> CouchbaseConverter,CouchbaseWriter<Object,CouchbaseDocument>
- Direct Known Subclasses:
MappingCouchbaseConverter
public abstract class AbstractCouchbaseConverter
extends Object
implements CouchbaseConverter, InitializingBean
An abstract
CouchbaseConverter that provides the basics for the MappingCouchbaseConverter.- Author:
- Michael Nitschinger, Mark Paluch, Michael Reiche, Vipul Gupta
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CustomConversionsHolds the custom conversions.protected final GenericConversionServiceContains the conversion service.protected EntityInstantiatorsContains the entity instantiators. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractCouchbaseConverter(GenericConversionService conversionService, CustomConversions customConversions) Create a new converter with custom conversions and hand it over theConversionService -
Method Summary
Modifier and TypeMethodDescriptionvoidDo nothing after the properties set on the bean.convertForWriteIfNeeded(Object inValue) This convertForWriteIfNeed takes only the value to convert.convertForWriteIfNeeded(CouchbasePersistentProperty prop, ConvertingPropertyAccessor<Object> accessor, boolean processValueConverter) This convertForWriteIfNeeded takes a property and accessor so that the annotations can be accessed (ie.return the conversionsReturn the conversion service.Class<?>getWriteClassFor(Class<?> clazz) Return the Class that would actually be stored for a given Class.voidsetCustomConversions(CustomConversions conversions) Set the custom conversions.voidsetInstantiators(EntityInstantiators instantiators) Set the entity instantiators.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.data.couchbase.core.convert.CouchbaseConverter
getTypeAlias, getTypeKeyMethods inherited from interface org.springframework.data.convert.EntityConverter
getMappingContextMethods inherited from interface org.springframework.data.convert.EntityReader
readMethods inherited from interface org.springframework.data.convert.EntityWriter
write
-
Field Details
-
conversionService
Contains the conversion service. -
instantiators
Contains the entity instantiators. -
conversions
Holds the custom conversions.
-
-
Constructor Details
-
AbstractCouchbaseConverter
protected AbstractCouchbaseConverter(GenericConversionService conversionService, CustomConversions customConversions) Create a new converter with custom conversions and hand it over theConversionService- Parameters:
conversionService- the conversion service to use.customConversions- the custom conversions to use
-
-
Method Details
-
getConversionService
Return the conversion service.- Specified by:
getConversionServicein interfaceEntityConverter<CouchbasePersistentEntity<?>,CouchbasePersistentProperty, Object, CouchbaseDocument> - Returns:
- the conversion service.
-
setCustomConversions
Set the custom conversions. Note that updating conversions requires a subsequent call to register them with the conversionService: conversions.registerConvertersIn(conversionService)- Parameters:
conversions- the conversions.
-
setInstantiators
Set the entity instantiators.- Parameters:
instantiators- the instantiators.
-
afterPropertiesSet
public void afterPropertiesSet()Do nothing after the properties set on the bean.- Specified by:
afterPropertiesSetin interfaceInitializingBean
-
convertForWriteIfNeeded
public Object convertForWriteIfNeeded(CouchbasePersistentProperty prop, ConvertingPropertyAccessor<Object> accessor, boolean processValueConverter) This convertForWriteIfNeeded takes a property and accessor so that the annotations can be accessed (ie. @Encrypted)- Specified by:
convertForWriteIfNeededin interfaceCouchbaseConverter- Parameters:
prop- the property to be converted to the class that would actually be stored.accessor- the property accessor- Returns:
-
convertForWriteIfNeeded
This convertForWriteIfNeed takes only the value to convert. It cannot access the annotations of the Field being converted.- Specified by:
convertForWriteIfNeededin interfaceCouchbaseConverter- Parameters:
inValue- the value to be converted to the class that would actually be stored.- Returns:
-
getWriteClassFor
Description copied from interface:CouchbaseConverterReturn the Class that would actually be stored for a given Class.- Specified by:
getWriteClassForin interfaceCouchbaseConverter- Parameters:
clazz- the source class.- Returns:
- the target class that would actually be stored.
- See Also:
-
getConversions
Description copied from interface:CouchbaseConverterreturn the conversions- Specified by:
getConversionsin interfaceCouchbaseConverter- Returns:
- conversions
-