SGF-609 - Adapt to changes in the Spring Data Commons API.

This commit is contained in:
John Blum
2017-03-31 12:33:21 -07:00
parent 4a46ee4c9c
commit 1a3909e948
9 changed files with 40 additions and 27 deletions

View File

@@ -17,7 +17,8 @@
package org.springframework.data.gemfire.domain;
import org.springframework.core.convert.converter.Converter;
import java.util.function.Function;
import org.springframework.data.domain.Page;
/**
@@ -56,7 +57,7 @@ public final class EmptyPage<T> extends EmptySlice<T> implements Page<T> {
*/
@Override
@SuppressWarnings("unchecked")
public <S> Page<S> map(Converter<? super T, ? extends S> converter) {
public <S> Page<S> map(Function<? super T, ? extends S> converter) {
return (Page<S>) EMPTY_PAGE;
}
}

View File

@@ -19,8 +19,8 @@ package org.springframework.data.gemfire.domain;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
import org.springframework.data.domain.Sort;
@@ -104,7 +104,7 @@ public abstract class EmptySlice<T> extends AbstractSliceSupport<T> {
*/
@Override
@SuppressWarnings("unchecked")
public <S> Slice<S> map(Converter<? super T, ? extends S> converter) {
public <S> Slice<S> map(Function<? super T, ? extends S> converter) {
return (Slice<S>) EMPTY_SLICE;
}
}

View File

@@ -22,9 +22,9 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Sort;
import org.springframework.data.gemfire.domain.support.AbstractPageSupport;
@@ -163,7 +163,7 @@ public class ListablePage<T> extends AbstractPageSupport<T> {
* @inheritDoc
*/
@Override
public <S> Page<S> map(Converter<? super T, ? extends S> converter) {
return newListablePage(getContent().stream().map(converter::convert).collect(Collectors.toList()));
public <S> Page<S> map(Function<? super T, ? extends S> converter) {
return newListablePage(getContent().stream().map(converter::apply).collect(Collectors.toList()));
}
}

View File

@@ -19,7 +19,8 @@ package org.springframework.data.gemfire.domain.support;
import static org.springframework.data.gemfire.util.RuntimeExceptionFactory.newUnsupportedOperationException;
import org.springframework.core.convert.converter.Converter;
import java.util.function.Function;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Slice;
import org.springframework.data.gemfire.util.RuntimeExceptionFactory;
@@ -58,7 +59,7 @@ public abstract class AbstractPageSupport<T> extends AbstractSliceSupport<T> imp
* @inheritDoc
*/
@Override
public <S> Page<S> map(Converter<? super T, ? extends S> converter) {
public <S> Page<S> map(Function<? super T, ? extends S> converter) {
throw newUnsupportedOperationException(RuntimeExceptionFactory.NOT_IMPLEMENTED);
}
}

View File

@@ -24,8 +24,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
import org.springframework.data.domain.Sort;
@@ -153,7 +153,7 @@ public abstract class AbstractSliceSupport<T> implements Slice<T> {
* @inheritDoc
*/
@Override
public <S> Slice<S> map(Converter<? super T, ? extends S> converter) {
public <S> Slice<S> map(Function<? super T, ? extends S> converter) {
throw newUnsupportedOperationException(RuntimeExceptionFactory.NOT_IMPLEMENTED);
}

View File

@@ -57,6 +57,17 @@ public class GemfireRepositoryFactoryBean<T extends Repository<S, ID>, S, ID ext
private MappingContext<? extends GemfirePersistentEntity<?>, GemfirePersistentProperty> mappingContext;
/**
* Creates a new {@link GemfireRepositoryFactoryBean} for the given {@link Repository} {@link Class interface}.
*
* @param repositoryInterface {@link Class interface type} specifying the application data access operations
* contract; must not be {@literal null}.
* @see java.lang.Class
*/
public GemfireRepositoryFactoryBean(Class<? extends T> repositoryInterface) {
super(repositoryInterface);
}
/**
* Sets a reference to the Spring {@link ApplicationContext} in which this object runs.
*

View File

@@ -23,11 +23,11 @@ import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.apache.geode.cache.lucene.LuceneResultStruct;
import org.apache.geode.cache.lucene.PageableLuceneQueryResults;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.domain.Page;
import org.springframework.data.gemfire.domain.support.AbstractPageSupport;
import org.springframework.data.gemfire.search.lucene.ProjectingLuceneAccessor;
@@ -327,7 +327,7 @@ public class LucenePage<T, K, V> extends AbstractPageSupport<T> {
* @inheritDoc
*/
@Override
public <S> Page<S> map(Converter<? super T, ? extends S> converter) {
return newListablePage(getContent().stream().map(converter::convert).collect(Collectors.toList()));
public <S> Page<S> map(Function<? super T, ? extends S> converter) {
return newListablePage(getContent().stream().map(converter::apply).collect(Collectors.toList()));
}
}