Package com.redis.om.spring.convert
Class MappingRedisOMConverter
java.lang.Object
com.redis.om.spring.convert.MappingRedisOMConverter
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean,org.springframework.data.convert.EntityConverter<org.springframework.data.redis.core.mapping.RedisPersistentEntity<?>,,org.springframework.data.redis.core.mapping.RedisPersistentProperty, Object, org.springframework.data.redis.core.convert.RedisData> org.springframework.data.convert.EntityReader<Object,,org.springframework.data.redis.core.convert.RedisData> org.springframework.data.convert.EntityWriter<Object,,org.springframework.data.redis.core.convert.RedisData> org.springframework.data.redis.core.convert.RedisConverter
public class MappingRedisOMConverter
extends Object
implements org.springframework.data.redis.core.convert.RedisConverter, org.springframework.beans.factory.InitializingBean
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classValue object representing a binary Redis Hash/Object identifier composed of keyspace and object id in the form of keyspace:id.static classValue object representing a Redis Hash/Object identifier composed of keyspace and object id in the form of keyspace:id. -
Constructor Summary
ConstructorsConstructorDescriptionMappingRedisOMConverter(org.springframework.data.redis.core.mapping.RedisMappingContext context) Creates newMappingRedisOMConverter.MappingRedisOMConverter(org.springframework.data.redis.core.mapping.RedisMappingContext mappingContext, org.springframework.data.redis.core.convert.ReferenceResolver referenceResolver) Creates newMappingRedisOMConverterand defaultsRedisMappingContextwhen null.MappingRedisOMConverter(org.springframework.data.redis.core.mapping.RedisMappingContext mappingContext, org.springframework.data.redis.core.convert.ReferenceResolver referenceResolver, org.springframework.data.redis.core.convert.RedisTypeMapper typeMapper) Creates newMappingRedisOMConverterand defaultsRedisMappingContextwhen null. -
Method Summary
Modifier and TypeMethodDescriptionvoid<T> TConvert given binary representation to desired target type using the underlyingConversionService.org.springframework.core.convert.ConversionServiceorg.springframework.data.redis.core.convert.IndexResolverorg.springframework.data.redis.core.mapping.RedisMappingContext<R> Rprotected ObjectreadProperty(Class<?> entityClass, String path, org.springframework.data.redis.core.convert.RedisData source, org.springframework.data.redis.core.mapping.RedisPersistentProperty persistentProperty) voidsetCustomConversions(org.springframework.data.convert.CustomConversions customConversions) SetCustomConversionsto be applied.voidsetReferenceResolver(org.springframework.data.redis.core.convert.ReferenceResolver referenceResolver) byte[]Convert given source to binary representation using the underlyingConversionService.voidprotected voidwritePartialUpdate(org.springframework.data.redis.core.PartialUpdate<?> update, org.springframework.data.redis.core.convert.RedisData sink)
-
Constructor Details
-
MappingRedisOMConverter
public MappingRedisOMConverter() -
MappingRedisOMConverter
public MappingRedisOMConverter(org.springframework.data.redis.core.mapping.RedisMappingContext context) Creates newMappingRedisOMConverter.- Parameters:
context- can be null.
-
MappingRedisOMConverter
public MappingRedisOMConverter(@Nullable org.springframework.data.redis.core.mapping.RedisMappingContext mappingContext, @Nullable org.springframework.data.redis.core.convert.ReferenceResolver referenceResolver) Creates newMappingRedisOMConverterand defaultsRedisMappingContextwhen null.- Parameters:
mappingContext- can be null.referenceResolver- can be not be null.
-
MappingRedisOMConverter
public MappingRedisOMConverter(@Nullable org.springframework.data.redis.core.mapping.RedisMappingContext mappingContext, @Nullable org.springframework.data.redis.core.convert.ReferenceResolver referenceResolver, @Nullable org.springframework.data.redis.core.convert.RedisTypeMapper typeMapper) Creates newMappingRedisOMConverterand defaultsRedisMappingContextwhen null.- Parameters:
mappingContext- can be null.referenceResolver- can be null.typeMapper- can be null.
-
-
Method Details
-
read
- Specified by:
readin interfaceorg.springframework.data.convert.EntityReader<Object,org.springframework.data.redis.core.convert.RedisData>
-
readProperty
-
write
- Specified by:
writein interfaceorg.springframework.data.convert.EntityWriter<Object,org.springframework.data.redis.core.convert.RedisData>
-
writePartialUpdate
protected void writePartialUpdate(org.springframework.data.redis.core.PartialUpdate<?> update, org.springframework.data.redis.core.convert.RedisData sink) -
toBytes
Convert given source to binary representation using the underlyingConversionService.- Parameters:
source- the source object- Returns:
- a byte array representation
- Throws:
org.springframework.core.convert.ConverterNotFoundException- if a specific converter cannot be found
-
fromBytes
Convert given binary representation to desired target type using the underlyingConversionService.- Type Parameters:
T- expected type of the source object- Parameters:
source- the source objecttype- the class to cast the object to- Returns:
- the target object
- Throws:
org.springframework.core.convert.ConverterNotFoundException- if a specific converter cannot be found
-
setReferenceResolver
public void setReferenceResolver(org.springframework.data.redis.core.convert.ReferenceResolver referenceResolver) -
setCustomConversions
public void setCustomConversions(@Nullable org.springframework.data.convert.CustomConversions customConversions) SetCustomConversionsto be applied.- Parameters:
customConversions- custom convertions to be added to the pipeline
-
getMappingContext
public org.springframework.data.redis.core.mapping.RedisMappingContext getMappingContext()- Specified by:
getMappingContextin interfaceorg.springframework.data.convert.EntityConverter<org.springframework.data.redis.core.mapping.RedisPersistentEntity<?>,org.springframework.data.redis.core.mapping.RedisPersistentProperty, Object, org.springframework.data.redis.core.convert.RedisData> - Specified by:
getMappingContextin interfaceorg.springframework.data.redis.core.convert.RedisConverter
-
getIndexResolver
@Nullable public org.springframework.data.redis.core.convert.IndexResolver getIndexResolver()- Specified by:
getIndexResolverin interfaceorg.springframework.data.redis.core.convert.RedisConverter
-
getConversionService
public org.springframework.core.convert.ConversionService getConversionService()- Specified by:
getConversionServicein interfaceorg.springframework.data.convert.EntityConverter<org.springframework.data.redis.core.mapping.RedisPersistentEntity<?>,org.springframework.data.redis.core.mapping.RedisPersistentProperty, Object, org.springframework.data.redis.core.convert.RedisData>
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-