Class ObjectHashMapper
java.lang.Object
org.springframework.data.redis.hash.ObjectHashMapper
- All Implemented Interfaces:
- HashMapper<Object,- byte[], - byte[]> 
HashMapper based on MappingRedisConverter. Supports nested properties and simple types like
 String.
 
 
 class Person {
   String firstname;
   String lastname;
   List<String> nicknames;
   List<Person> coworkers;
   Address address;
 }
 
 
 The above is represented as:
 
 
 _class=org.example.Person
 firstname=rand
 lastname=al'thor
 coworkers.[0].firstname=mat
 coworkers.[0].nicknames.[0]=prince of the ravens
 coworkers.[1].firstname=perrin
 coworkers.[1].address.city=two rivers
 
 - Since:
- 1.8
- Author:
- Christoph Strobl, Mark Paluch
- 
Constructor SummaryConstructorsConstructorDescriptionCreates newObjectHashMapper.ObjectHashMapper(CustomConversions customConversions) Creates newObjectHashMapper.ObjectHashMapper(RedisConverter converter) Creates a newObjectHashMapperusing the givenRedisConverterfor conversion.
- 
Method SummaryModifier and TypeMethodDescriptionConvert ahash(map) to an object.<T> TConvert ahash(map) to an object and return the casted result.static ObjectHashMapperReturn a shared defaultObjectHashMapperinstance, lazily building it once needed.Map<byte[],byte[]> Convert anobjectto a map that can be used with Redis hashes.
- 
Constructor Details- 
ObjectHashMapperpublic ObjectHashMapper()Creates newObjectHashMapper.
- 
ObjectHashMapperCreates a newObjectHashMapperusing the givenRedisConverterfor conversion.- Parameters:
- converter- must not be null.
- Throws:
- IllegalArgumentException- if the given converter is null.
- Since:
- 2.4
 
- 
ObjectHashMapperCreates newObjectHashMapper.- Parameters:
- customConversions- can be null.
- Since:
- 2.0
 
 
- 
- 
Method Details
- 
toHashDescription copied from interface:HashMapperConvert anobjectto a map that can be used with Redis hashes.- Specified by:
- toHashin interface- HashMapper<Object,- byte[], - byte[]> 
- Returns:
 
- 
fromHashDescription copied from interface:HashMapperConvert ahash(map) to an object.- Specified by:
- fromHashin interface- HashMapper<Object,- byte[], - byte[]> 
- Returns:
 
- 
fromHashConvert ahash(map) to an object and return the casted result.- Type Parameters:
- T-
- Parameters:
- hash-
- type-
- Returns: