From abc561088ecbc5c23ee27a8668798861fbe32912 Mon Sep 17 00:00:00 2001 From: John Blum Date: Thu, 15 Apr 2021 13:53:08 -0700 Subject: [PATCH] Annotate API with Spring's @NonNull & @Nullable annotations appropriately. --- .../data/gemfire/client/ClientCacheFactoryBean.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/spring-data-geode/src/main/java/org/springframework/data/gemfire/client/ClientCacheFactoryBean.java b/spring-data-geode/src/main/java/org/springframework/data/gemfire/client/ClientCacheFactoryBean.java index 9350128c..99ad6d70 100644 --- a/spring-data-geode/src/main/java/org/springframework/data/gemfire/client/ClientCacheFactoryBean.java +++ b/spring-data-geode/src/main/java/org/springframework/data/gemfire/client/ClientCacheFactoryBean.java @@ -348,7 +348,7 @@ public class ClientCacheFactoryBean extends CacheFactoryBean implements Applicat * @see #findPool(String) * @see #isPoolNameResolvable(String) */ - protected Pool resolvePool() { + protected @Nullable Pool resolvePool() { Pool pool = getPool(); @@ -372,21 +372,22 @@ public class ClientCacheFactoryBean extends CacheFactoryBean implements Applicat return pool; } - private boolean isPoolNameResolvable(String poolName) { + private boolean isPoolNameResolvable(@Nullable String poolName) { return Optional.ofNullable(poolName) + .filter(StringUtils::hasText) .filter(getBeanFactory()::containsBean) .isPresent(); } - String resolvePoolName() { + @NonNull String resolvePoolName() { return Optional.ofNullable(getPoolName()) .filter(StringUtils::hasText) .orElseGet(this::getDefaultPoolName); } - String getDefaultPoolName() { + @NonNull String getDefaultPoolName() { return GemfireConstants.DEFAULT_GEMFIRE_POOL_NAME; } @@ -406,7 +407,7 @@ public class ClientCacheFactoryBean extends CacheFactoryBean implements Applicat */ @Override @SuppressWarnings("unchecked") - protected T createCache(Object factory) { + protected @NonNull T createCache(@NonNull Object factory) { return (T) ((ClientCacheFactory) factory).create(); }