Package org.springframework.geode.cache
Class RepositoryCacheLoaderRegionConfigurer<T,ID>
java.lang.Object
org.springframework.geode.cache.RepositoryCacheLoaderRegionConfigurer<T,ID>
- Type Parameters:
T
-type
of the persistent entity.ID
-type
of the persistent entity identifier (ID).
- All Implemented Interfaces:
org.springframework.core.Ordered
,org.springframework.data.gemfire.config.annotation.RegionConfigurer
,org.springframework.data.gemfire.config.annotation.support.Configurer<org.springframework.data.gemfire.client.ClientRegionFactoryBean<?,
?>>
public class RepositoryCacheLoaderRegionConfigurer<T,ID>
extends Object
implements org.springframework.data.gemfire.config.annotation.RegionConfigurer
Spring Data
RegionConfigurer
implementation used to adapt and register a Spring Data CrudRepository
as a CacheLoader
for a targeted Region
.- Since:
- 1.1.0
- See Also:
-
Predicate
CacheLoader
Region
PeerRegionFactoryBean
ClientRegionFactoryBean
RegionConfigurer
CrudRepository
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionRepositoryCacheLoaderRegionConfigurer
(org.springframework.data.repository.CrudRepository<T, ID> repository, Predicate<String> regionBeanName) Constructs a new instance ofRepositoryCacheLoaderRegionConfigurer
initialized with the given Spring DataCrudRepository
used to loadRegion
values on cache misses as well as the givenPredicate
used to identify/qualify theRegion
on which theCrudRepository
will be registered and used as aCacheLoader
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(String beanName, org.springframework.data.gemfire.client.ClientRegionFactoryBean<?, ?> bean) void
static <T,
ID> RepositoryCacheLoaderRegionConfigurer<T, ID> Factory method used to construct a new instance ofRepositoryCacheLoaderRegionConfigurer
initialized with the given Spring DataCrudRepository
used to loadRegion
values on cache misses as well as the givenString
identifying/qualifying theRegion
on which theCrudRepository
will be registered and used as aCacheLoader
.static <T,
ID> RepositoryCacheLoaderRegionConfigurer<T, ID> create
(org.springframework.data.repository.CrudRepository<T, ID> repository, Predicate<String> regionBeanName) Factory method used to construct a new instance ofRepositoryCacheLoaderRegionConfigurer
initialized with the given Spring DataCrudRepository
used to loadRegion
values on cache misses as well as the givenPredicate
used to identify/qualify theRegion
on which theCrudRepository
will be registered and used as aCacheLoader
.Returns the configuredPredicate
used to identify/qualify theRegion
on which theCrudRepository
will be registered as aCacheLoader
for cache misses.Returns the configured Spring DataCrudRepository
adapted/wrapped as aCacheLoader
and used to loadRegion
values on cache misses.protected RepositoryCacheLoader
Constructs a new instance ofRepositoryCacheLoader
adapting theCrudRepository
as an instance of aCacheLoader
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.data.gemfire.config.annotation.support.Configurer
getOrder
-
Constructor Details
-
RepositoryCacheLoaderRegionConfigurer
public RepositoryCacheLoaderRegionConfigurer(@NonNull org.springframework.data.repository.CrudRepository<T, ID> repository, @Nullable Predicate<String> regionBeanName) Constructs a new instance ofRepositoryCacheLoaderRegionConfigurer
initialized with the given Spring DataCrudRepository
used to loadRegion
values on cache misses as well as the givenPredicate
used to identify/qualify theRegion
on which theCrudRepository
will be registered and used as aCacheLoader
.- Parameters:
repository
-CrudRepository
used to loadRegion
values on cache misses.regionBeanName
-Predicate
used to identify/qualify theRegion
on which theCrudRepository
will be registered and used as aCacheLoader
.- Throws:
IllegalArgumentException
- ifCrudRepository
is null.- See Also:
-
CrudRepository
Predicate
-
-
Method Details
-
create
public static <T,ID> RepositoryCacheLoaderRegionConfigurer<T,ID> create(@NonNull org.springframework.data.repository.CrudRepository<T, ID> repository, @Nullable Predicate<String> regionBeanName) Factory method used to construct a new instance ofRepositoryCacheLoaderRegionConfigurer
initialized with the given Spring DataCrudRepository
used to loadRegion
values on cache misses as well as the givenPredicate
used to identify/qualify theRegion
on which theCrudRepository
will be registered and used as aCacheLoader
.- Type Parameters:
T
-type
of the persistent entity.ID
-type
of the persistent entity identifier (ID).- Parameters:
repository
-CrudRepository
used to loadRegion
values on cache misses.regionBeanName
-Predicate
used to identify/qualify theRegion
on which theCrudRepository
will be registered and used as aCacheLoader
.- Returns:
- a new instance of
RepositoryCacheLoaderRegionConfigurer
. - Throws:
IllegalArgumentException
- ifCrudRepository
is null.- See Also:
-
create
public static <T,ID> RepositoryCacheLoaderRegionConfigurer<T,ID> create(@NonNull org.springframework.data.repository.CrudRepository<T, ID> repository, @Nullable String regionBeanName) Factory method used to construct a new instance ofRepositoryCacheLoaderRegionConfigurer
initialized with the given Spring DataCrudRepository
used to loadRegion
values on cache misses as well as the givenString
identifying/qualifying theRegion
on which theCrudRepository
will be registered and used as aCacheLoader
.- Type Parameters:
T
-type
of the persistent entity.ID
-type
of the persistent entity identifier (ID).- Parameters:
repository
-CrudRepository
used to loadRegion
values on cache misses.regionBeanName
-String
containing the bean name identifying/qualifying theRegion
on which theCrudRepository
will be registered and used as aCacheLoader
.- Returns:
- a new instance of
RepositoryCacheLoaderRegionConfigurer
. - Throws:
IllegalArgumentException
- ifCrudRepository
is null.- See Also:
-
CrudRepository
String
create(CrudRepository, Predicate)
-
getRegionBeanName
Returns the configuredPredicate
used to identify/qualify theRegion
on which theCrudRepository
will be registered as aCacheLoader
for cache misses. -
getRepository
Returns the configured Spring DataCrudRepository
adapted/wrapped as aCacheLoader
and used to loadRegion
values on cache misses.- Returns:
- the configured
CrudRepository
used to loadRegion
values on cache misses. - See Also:
-
CrudRepository
-
configure
public void configure(String beanName, org.springframework.data.gemfire.client.ClientRegionFactoryBean<?, ?> bean) - Specified by:
configure
in interfaceorg.springframework.data.gemfire.config.annotation.support.Configurer<T>
- Specified by:
configure
in interfaceorg.springframework.data.gemfire.config.annotation.RegionConfigurer
-
configure
public void configure(String beanName, org.springframework.data.gemfire.PeerRegionFactoryBean<?, ?> bean) - Specified by:
configure
in interfaceorg.springframework.data.gemfire.config.annotation.RegionConfigurer
-
newRepositoryCacheLoader
Constructs a new instance ofRepositoryCacheLoader
adapting theCrudRepository
as an instance of aCacheLoader
.- Returns:
- a new
RepositoryCacheLoader
. - See Also:
-
RepositoryCacheLoader
CrudRepository
CacheLoader
getRepository()
-