DATAREDIS-503 - Add HashMapper implementation based on MappingRedisConverter.

We now support mapping of simple and complex types to Redis HASH structures applying the same structure as the Repository support. This allows Object to hash Mapping and its direct usage via RedisTemplate without the need of explicitly having to use the repository abstraction.

Original pull request: #194.
This commit is contained in:
Christoph Strobl
2016-04-29 13:53:11 +02:00
committed by Mark Paluch
parent f5ecd3a9b1
commit 359c3e4533
3 changed files with 197 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
/*
* Copyright 2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.redis.mapping;
import org.junit.Test;
import org.springframework.data.redis.hash.ConvertingHashMapper;
/**
* @author Christoph Strobl
*/
public class ConvertingHashMapperTests extends AbstractHashMapperTest {
protected ConvertingHashMapper mapperFor(Class t) {
return new ConvertingHashMapper();
}
/**
* @see DATAREDIS-503
*/
@Test
public void testSimpleType() {
assertBackAndForwardMapping(new Integer(100));
}
}