public class ObjectHashMapper extends Object implements 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
Constructor and Description |
---|
ObjectHashMapper()
Creates new
ObjectHashMapper . |
ObjectHashMapper(CustomConversions customConversions)
Deprecated.
|
ObjectHashMapper(CustomConversions customConversions)
Creates new
ObjectHashMapper . |
Modifier and Type | Method and Description |
---|---|
Object |
fromHash(Map<byte[],byte[]> hash)
Convert a
hash (map) to an object. |
<T> T |
fromHash(Map<byte[],byte[]> hash,
Class<T> type)
Convert a
hash (map) to an object and return the casted result. |
Map<byte[],byte[]> |
toHash(Object source)
Convert an
object to a map that can be used with Redis hashes. |
public ObjectHashMapper()
ObjectHashMapper
.@Deprecated public ObjectHashMapper(CustomConversions customConversions)
ObjectHashMapper(org.springframework.data.convert.CustomConversions)
.ObjectHashMapper
.customConversions
- can be null.public ObjectHashMapper(@Nullable CustomConversions customConversions)
ObjectHashMapper
.customConversions
- can be null.public Map<byte[],byte[]> toHash(Object source)
HashMapper
object
to a map that can be used with Redis hashes.toHash
in interface HashMapper<Object,byte[],byte[]>
public Object fromHash(Map<byte[],byte[]> hash)
HashMapper
hash
(map) to an object.fromHash
in interface HashMapper<Object,byte[],byte[]>
Copyright © 2011–2019 Pivotal Software, Inc.. All rights reserved.