public class ComposableCacheResolver<T extends org.apache.geode.cache.GemFireCache> extends AbstractCachingCacheResolver<T>
CacheResolvers
using
the Composite Software Design Pattern that acts,
and can be referred to, as a single instance of CacheResolver
.
This implementation also supports caching the result of the resolution of the GemFireCache
instance reference.GemFireCache
,
CacheResolver
,
AbstractCachingCacheResolver
Modifier | Constructor and Description |
---|---|
protected |
ComposableCacheResolver(CacheResolver<T> cacheResolverOne,
CacheResolver<T> cacheResolverTwo)
Constructs a new instance of
ComposableCacheResolver initialized and composed with
the given CacheResolvers forming the composition. |
Modifier and Type | Method and Description |
---|---|
static <T extends org.apache.geode.cache.GemFireCache> |
compose(CacheResolver<T>... cacheResolvers)
Factory method used to compose an array of
CacheResolvers in a composition. |
static <T extends org.apache.geode.cache.GemFireCache> |
compose(CacheResolver<T> one,
CacheResolver<T> two)
Null-safe factory method used to compose two
CacheResolver objects in a composition. |
static <T extends org.apache.geode.cache.GemFireCache> |
compose(Iterable<CacheResolver<T>> cacheResolvers)
Factory method used to compose an
Iterable collection of CacheResolvers
in a composition. |
T |
doResolve()
Resolves the first, single reference to a
GemFireCache , handling any Exceptions
throwing by the composed CacheResolvers , such as a CacheClosedException . |
protected CacheResolver<T> |
getCacheResolverOne()
Returns a reference to the first, non-null, configured
CacheResolver in the composition. |
protected CacheResolver<T> |
getCacheResolverTwo()
Returns a reference to the second, non-null, configured
CacheResolver in the composition. |
resolve
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get
protected ComposableCacheResolver(@NonNull CacheResolver<T> cacheResolverOne, @NonNull CacheResolver<T> cacheResolverTwo)
ComposableCacheResolver
initialized and composed with
the given CacheResolvers
forming the composition.cacheResolverOne
- first CacheResolver
in the composition.cacheResolverTwo
- second CacheResolver
in the composition.IllegalArgumentException
- if either CacheResolver
argument is null.CacheResolver
@Nullable public static <T extends org.apache.geode.cache.GemFireCache> CacheResolver<T> compose(@Nullable CacheResolver<T>... cacheResolvers)
CacheResolvers
in a composition.T
- subclass
of GemFireCache
.cacheResolvers
- array of CacheResolvers
to compose; may be null.CacheResolvers
; may be null.CacheResolver
,
compose(Iterable)
@Nullable public static <T extends org.apache.geode.cache.GemFireCache> CacheResolver<T> compose(@Nullable Iterable<CacheResolver<T>> cacheResolvers)
Iterable
collection of CacheResolvers
in a composition.T
- subclass
of GemFireCache
.cacheResolvers
- Iterable
collection of CacheResolvers
to compose;
may be null.Iterable
collection of CacheResolvers
;
may be null.compose(CacheResolver, CacheResolver)
,
CacheResolver
,
Iterable
@Nullable public static <T extends org.apache.geode.cache.GemFireCache> CacheResolver<T> compose(@Nullable CacheResolver<T> one, @Nullable CacheResolver<T> two)
CacheResolver
objects in a composition.T
- subclass
of GemFireCache
.one
- first CacheResolver
in the composition.two
- second CacheResolver
in the composition.CacheResolver
if the second CacheResolver
is null.
Return the second CacheResolver
if the first CacheResolver
is null.
Otherwise, return a composition of both CacheResolver
one and two as a ComposableCacheResolver
.CacheResolver
,
ComposableCacheResolver(CacheResolver, CacheResolver)
@NonNull protected CacheResolver<T> getCacheResolverOne()
CacheResolver
in the composition.CacheResolver
in the composition.CacheResolver
@NonNull protected CacheResolver<T> getCacheResolverTwo()
CacheResolver
in the composition.CacheResolver
in the composition.CacheResolver
public T doResolve()
GemFireCache
, handling any Exceptions
throwing by the composed CacheResolvers
, such as a CacheClosedException
.
This method may ultimately still result in a thrown Exception
, but it will make a best effort to
exhaustively consult all composed CacheResolvers
.doResolve
in class AbstractCachingCacheResolver<T extends org.apache.geode.cache.GemFireCache>
GemFireCache
.CacheResolver.resolve()
,
GemFireCache
,
getCacheResolverOne()
,
getCacheResolverTwo()
Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.