public abstract class RepositoryFactorySupport extends Object implements BeanClassLoaderAware, BeanFactoryAware
QueryExecuterMethodInterceptor. Query
detection strategy can be configured by setting QueryLookupStrategy.Key.| Modifier and Type | Class and Description |
|---|---|
class |
RepositoryFactorySupport.QueryExecutorMethodInterceptor
This
MethodInterceptor intercepts calls to methods of the custom implementation and delegates the to it if
configured. |
| Constructor and Description |
|---|
RepositoryFactorySupport() |
| Modifier and Type | Method and Description |
|---|---|
void |
addQueryCreationListener(QueryCreationListener<?> listener)
Adds a
QueryCreationListener to the factory to plug in functionality triggered right after creation of
RepositoryQuery instances. |
void |
addRepositoryProxyPostProcessor(RepositoryProxyPostProcessor processor)
Adds
RepositoryProxyPostProcessors to the factory to allow manipulation of the ProxyFactory before
the proxy gets created. |
abstract <T,ID extends Serializable> |
getEntityInformation(Class<T> domainClass)
Returns the
EntityInformation for the given domain class. |
protected ProjectionFactory |
getProjectionFactory(ClassLoader classLoader,
BeanFactory beanFactory)
Returns the
ProjectionFactory to be used with the repository instances created. |
protected QueryLookupStrategy |
getQueryLookupStrategy(QueryLookupStrategy.Key key)
Deprecated.
favor
#getQueryLookupStrategy(Key, EvaluationContextProvider) |
protected QueryLookupStrategy |
getQueryLookupStrategy(QueryLookupStrategy.Key key,
EvaluationContextProvider evaluationContextProvider)
Returns the
QueryLookupStrategy for the given QueryLookupStrategy.Key and EvaluationContextProvider. |
protected List<QueryMethod> |
getQueryMethods() |
<T> T |
getRepository(Class<T> repositoryInterface)
Returns a repository instance for the given interface.
|
<T> T |
getRepository(Class<T> repositoryInterface,
Object customImplementation)
Returns a repository instance for the given interface backed by an instance providing implementation logic for
custom logic.
|
protected abstract Class<?> |
getRepositoryBaseClass(RepositoryMetadata metadata)
Returns the base class backing the actual repository instance.
|
protected RepositoryInformation |
getRepositoryInformation(RepositoryMetadata metadata,
Class<?> customImplementationClass)
Returns the
RepositoryInformation for the given repository interface. |
protected RepositoryMetadata |
getRepositoryMetadata(Class<?> repositoryInterface)
Returns the
RepositoryMetadata for the given repository interface. |
protected abstract Object |
getTargetRepository(RepositoryInformation metadata)
Create a repository instance as backing for the query proxy.
|
protected <R> R |
getTargetRepositoryViaReflection(RepositoryInformation information,
Object... constructorArguments)
Creates a repository of the repository base class defined in the given
RepositoryInformation using
reflection. |
void |
setBeanClassLoader(ClassLoader classLoader) |
void |
setBeanFactory(BeanFactory beanFactory) |
void |
setEvaluationContextProvider(EvaluationContextProvider evaluationContextProvider)
Sets the
EvaluationContextProvider to be used to evaluate SpEL expressions in manually defined queries. |
void |
setNamedQueries(NamedQueries namedQueries)
Configures a
NamedQueries instance to be handed to the QueryLookupStrategy for query creation. |
void |
setQueryLookupStrategyKey(QueryLookupStrategy.Key key)
Sets the strategy of how to lookup a query to execute finders.
|
void |
setRepositoryBaseClass(Class<?> repositoryBaseClass)
Configures the repository base class to use when creating the repository proxy.
|
protected void |
validate(RepositoryMetadata repositoryMetadata) |
public void setQueryLookupStrategyKey(QueryLookupStrategy.Key key)
key - public void setNamedQueries(NamedQueries namedQueries)
NamedQueries instance to be handed to the QueryLookupStrategy for query creation.namedQueries - the namedQueries to setpublic void setBeanClassLoader(ClassLoader classLoader)
setBeanClassLoader in interface BeanClassLoaderAwarepublic void setBeanFactory(BeanFactory beanFactory) throws BeansException
setBeanFactory in interface BeanFactoryAwareBeansExceptionpublic void setEvaluationContextProvider(EvaluationContextProvider evaluationContextProvider)
EvaluationContextProvider to be used to evaluate SpEL expressions in manually defined queries.evaluationContextProvider - can be null, defaults to
DefaultEvaluationContextProvider.INSTANCE.public void setRepositoryBaseClass(Class<?> repositoryBaseClass)
getRepositoryBaseClass(RepositoryMetadata) by default.repositoryBaseClass - the repository base class to back the repository proxy, can be null.public void addQueryCreationListener(QueryCreationListener<?> listener)
QueryCreationListener to the factory to plug in functionality triggered right after creation of
RepositoryQuery instances.listener - public void addRepositoryProxyPostProcessor(RepositoryProxyPostProcessor processor)
RepositoryProxyPostProcessors to the factory to allow manipulation of the ProxyFactory before
the proxy gets created. Note that the RepositoryFactorySupport.QueryExecutorMethodInterceptor will be added to the proxy
after the RepositoryProxyPostProcessors are considered.processor - public <T> T getRepository(Class<T> repositoryInterface)
T - repositoryInterface - public <T> T getRepository(Class<T> repositoryInterface, Object customImplementation)
T - repositoryInterface - customImplementation - protected ProjectionFactory getProjectionFactory(ClassLoader classLoader, BeanFactory beanFactory)
ProjectionFactory to be used with the repository instances created.classLoader - will never be null.beanFactory - will never be null.protected RepositoryMetadata getRepositoryMetadata(Class<?> repositoryInterface)
RepositoryMetadata for the given repository interface.repositoryInterface - will never be null.protected RepositoryInformation getRepositoryInformation(RepositoryMetadata metadata, Class<?> customImplementationClass)
RepositoryInformation for the given repository interface.metadata - customImplementationClass - protected List<QueryMethod> getQueryMethods()
public abstract <T,ID extends Serializable> EntityInformation<T,ID> getEntityInformation(Class<T> domainClass)
EntityInformation for the given domain class.T - the entity typeID - the id typedomainClass - protected abstract Object getTargetRepository(RepositoryInformation metadata)
metadata - protected abstract Class<?> getRepositoryBaseClass(RepositoryMetadata metadata)
#getTargetRepository(RepositoryMetadata) returns an instance of this class.metadata - protected QueryLookupStrategy getQueryLookupStrategy(QueryLookupStrategy.Key key)
#getQueryLookupStrategy(Key, EvaluationContextProvider)QueryLookupStrategy for the given QueryLookupStrategy.Key.key - can be nullQueryLookupStrategy to use or null if no queries should be looked up.protected QueryLookupStrategy getQueryLookupStrategy(QueryLookupStrategy.Key key, EvaluationContextProvider evaluationContextProvider)
QueryLookupStrategy for the given QueryLookupStrategy.Key and EvaluationContextProvider.key - can be null.evaluationContextProvider - will never be null.QueryLookupStrategy to use or null if no queries should be looked up.protected void validate(RepositoryMetadata repositoryMetadata)
protected final <R> R getTargetRepositoryViaReflection(RepositoryInformation information, Object... constructorArguments)
RepositoryInformation using
reflection.information - constructorArguments - Copyright © 2011–2019 Pivotal Software, Inc.. All rights reserved.