1 | /* |
2 | * Copyright 2002-2013 the original author or authors. |
3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
5 | * the License. You may obtain a copy of the License at |
6 | * |
7 | * http://www.apache.org/licenses/LICENSE-2.0 |
8 | * |
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
10 | * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
11 | * specific language governing permissions and limitations under the License. |
12 | */ |
13 | package org.springframework.batch.item.data; |
14 | |
15 | import org.springframework.batch.item.SpELItemKeyMapper; |
16 | import org.springframework.util.Assert; |
17 | |
18 | /** |
19 | * A convenient {@link GemfireItemWriter} implementation that uses a {@link SpELItemKeyMapper} |
20 | * |
21 | * @author David Turanski |
22 | * @since 2.2 |
23 | */ |
24 | public class SpELMappingGemfireItemWriter<K, V> extends GemfireItemWriter<K, V> { |
25 | /** |
26 | * A constructor that accepts a SpEL expression used to derive the key |
27 | * @param keyExpression |
28 | */ |
29 | SpELMappingGemfireItemWriter(String keyExpression) { |
30 | super(); |
31 | Assert.hasText(keyExpression, "a valid keyExpression is required."); |
32 | setItemKeyMapper(new SpELItemKeyMapper<K, V>(keyExpression)); |
33 | } |
34 | } |