diff --git a/spring-data-geode/src/main/java/org/springframework/data/gemfire/repository/Wrapper.java b/spring-data-geode/src/main/java/org/springframework/data/gemfire/repository/Wrapper.java index 7cca1346..ac0d81f0 100644 --- a/spring-data-geode/src/main/java/org/springframework/data/gemfire/repository/Wrapper.java +++ b/spring-data-geode/src/main/java/org/springframework/data/gemfire/repository/Wrapper.java @@ -13,21 +13,42 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.springframework.data.gemfire.repository; -import lombok.NonNull; -import lombok.Value; +import org.springframework.lang.NonNull; +import org.springframework.util.Assert; /** - * Simple value object holding an entity along with the external key in which the entity will be mapped. + * Simple {@link Object value object} holding an entity along with the external key in which the entity will be mapped. * * @author Oliver Gierke + * @author John Blum */ -@Value public class Wrapper { - T entity; - @NonNull KEY key; + private final T entity; + private final KEY key; + + public Wrapper(@NonNull T entity, @NonNull KEY key) { + + Assert.notNull(entity, "Entity must not be null"); + Assert.notNull(key, "Key must not be null"); + + this.entity = entity; + this.key = key; + } + + public T getEntity() { + return this.entity; + } + + public KEY getKey() { + return this.key; + } + + @Override + public String toString() { + return String.format("{ key: %1$s, value: %2$s }", getKey(), getEntity()); + } } diff --git a/spring-data-geode/src/main/java/org/springframework/data/gemfire/repository/support/GemfireRepositoryFactoryBean.java b/spring-data-geode/src/main/java/org/springframework/data/gemfire/repository/support/GemfireRepositoryFactoryBean.java index 01ca9da3..ac12b27a 100644 --- a/spring-data-geode/src/main/java/org/springframework/data/gemfire/repository/support/GemfireRepositoryFactoryBean.java +++ b/spring-data-geode/src/main/java/org/springframework/data/gemfire/repository/support/GemfireRepositoryFactoryBean.java @@ -49,10 +49,7 @@ import org.springframework.data.util.ClassTypeInformation; import org.springframework.data.util.TypeInformation; import org.springframework.lang.NonNull; import org.springframework.util.Assert; - -import lombok.EqualsAndHashCode; -import lombok.Getter; -import lombok.RequiredArgsConstructor; +import org.springframework.util.ObjectUtils; /** * {@link FactoryBean} adapter for {@link GemfireRepositoryFactory}. @@ -326,13 +323,54 @@ public class GemfireRepositoryFactoryBean, S, ID> return repositoryQuery; } - @EqualsAndHashCode - @RequiredArgsConstructor(staticName = "of") private static class QueryPostProcessorKey { - @lombok.NonNull @Getter - QueryPostProcessor queryPostProcessor; + public static QueryPostProcessorKey of(QueryPostProcessor queryPostProcessor) { + return new QueryPostProcessorKey(queryPostProcessor); + } + private final QueryPostProcessor queryPostProcessor; + + public QueryPostProcessorKey(@NonNull QueryPostProcessor queryPostProcessor) { + + Assert.notNull(queryPostProcessor, "QueryPostProcessor must not be null"); + + this.queryPostProcessor = queryPostProcessor; + } + + protected @NonNull QueryPostProcessor getQueryPostProcessor() { + return this.queryPostProcessor; + } + + @Override + public boolean equals(Object obj) { + + if (this == obj) { + return true; + } + + if (!(obj instanceof QueryPostProcessorKey)) { + return false; + } + + QueryPostProcessorKey that = (QueryPostProcessorKey) obj; + + return this.getQueryPostProcessor().equals(that.getQueryPostProcessor()); + } + + @Override + public int hashCode() { + + int hashValue = 17; + + hashValue = 37 * hashValue + ObjectUtils.nullSafeHashCode(this.getQueryPostProcessor()); + return hashValue; + } + + @Override + public String toString() { + return String.format("{ queryPostProcessor: %s }", getQueryPostProcessor()); + } } } }