Spring Data Core

org.springframework.data.repository.core.support
Class RepositoryFactoryBeanSupport<T extends Repository<S,ID>,S,ID extends Serializable>

java.lang.Object
  extended by org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport<T,S,ID>
Type Parameters:
T - the type of the repository
All Implemented Interfaces:
Aware, BeanClassLoaderAware, FactoryBean<T>, InitializingBean, RepositoryFactoryInformation<S,ID>
Direct Known Subclasses:
TransactionalRepositoryFactoryBeanSupport

public abstract class RepositoryFactoryBeanSupport<T extends Repository<S,ID>,S,ID extends Serializable>
extends Object
implements InitializingBean, RepositoryFactoryInformation<S,ID>, FactoryBean<T>, BeanClassLoaderAware

Adapter for Springs FactoryBean interface to allow easy setup of repository factories via Spring configuration.

Author:
Oliver Gierke

Constructor Summary
RepositoryFactoryBeanSupport()
           
 
Method Summary
 void afterPropertiesSet()
           
protected abstract  RepositoryFactorySupport createRepositoryFactory()
          Create the actual RepositoryFactorySupport instance.
 EntityInformation<S,ID> getEntityInformation()
          Returns EntityInformation the repository factory is using.
 T getObject()
           
 Class<? extends T> getObjectType()
           
 PersistentEntity<?,?> getPersistentEntity()
          Returns the PersistentEntity managed by the underlying repository.
 List<QueryMethod> getQueryMethods()
          Returns all QueryMethods declared for that repository.
 RepositoryInformation getRepositoryInformation()
          Returns the RepositoryInformation to determine meta-information about the repository being used.
 boolean isSingleton()
           
 void setBeanClassLoader(ClassLoader classLoader)
           
 void setCustomImplementation(Object customImplementation)
          Setter to inject a custom repository implementation.
protected  void setMappingContext(MappingContext<?,?> mappingContext)
          Configures the MappingContext to be used to lookup PersistentEntity instances for getPersistentEntity().
 void setNamedQueries(NamedQueries namedQueries)
          Setter to inject a NamedQueries instance.
 void setQueryLookupStrategyKey(QueryLookupStrategy.Key queryLookupStrategyKey)
          Set the QueryLookupStrategy.Key to be used.
 void setRepositoryInterface(Class<? extends T> repositoryInterface)
          Setter to inject the repository interface to implement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryFactoryBeanSupport

public RepositoryFactoryBeanSupport()
Method Detail

setRepositoryInterface

public void setRepositoryInterface(Class<? extends T> repositoryInterface)
Setter to inject the repository interface to implement.

Parameters:
repositoryInterface - the repository interface to set

setQueryLookupStrategyKey

public void setQueryLookupStrategyKey(QueryLookupStrategy.Key queryLookupStrategyKey)
Set the QueryLookupStrategy.Key to be used.

Parameters:
queryLookupStrategyKey -

setCustomImplementation

public void setCustomImplementation(Object customImplementation)
Setter to inject a custom repository implementation.

Parameters:
customImplementation -

setNamedQueries

public void setNamedQueries(NamedQueries namedQueries)
Setter to inject a NamedQueries instance.

Parameters:
namedQueries - the namedQueries to set

setMappingContext

protected void setMappingContext(MappingContext<?,?> mappingContext)
Configures the MappingContext to be used to lookup PersistentEntity instances for getPersistentEntity().

Parameters:
mappingContext -

setBeanClassLoader

public void setBeanClassLoader(ClassLoader classLoader)
Specified by:
setBeanClassLoader in interface BeanClassLoaderAware

getEntityInformation

public EntityInformation<S,ID> getEntityInformation()
Description copied from interface: RepositoryFactoryInformation
Returns EntityInformation the repository factory is using.

Specified by:
getEntityInformation in interface RepositoryFactoryInformation<S,ID extends Serializable>
Returns:

getRepositoryInformation

public RepositoryInformation getRepositoryInformation()
Description copied from interface: RepositoryFactoryInformation
Returns the RepositoryInformation to determine meta-information about the repository being used.

Specified by:
getRepositoryInformation in interface RepositoryFactoryInformation<S,ID extends Serializable>
Returns:

getPersistentEntity

public PersistentEntity<?,?> getPersistentEntity()
Description copied from interface: RepositoryFactoryInformation
Returns the PersistentEntity managed by the underlying repository. Can be null in case the underlying persistence mechanism does not expose a MappingContext.

Specified by:
getPersistentEntity in interface RepositoryFactoryInformation<S,ID extends Serializable>
Returns:

getQueryMethods

public List<QueryMethod> getQueryMethods()
Description copied from interface: RepositoryFactoryInformation
Returns all QueryMethods declared for that repository.

Specified by:
getQueryMethods in interface RepositoryFactoryInformation<S,ID extends Serializable>
Returns:

getObject

public T getObject()
Specified by:
getObject in interface FactoryBean<T extends Repository<S,ID>>

getObjectType

public Class<? extends T> getObjectType()
Specified by:
getObjectType in interface FactoryBean<T extends Repository<S,ID>>

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface FactoryBean<T extends Repository<S,ID>>

afterPropertiesSet

public void afterPropertiesSet()
Specified by:
afterPropertiesSet in interface InitializingBean

createRepositoryFactory

protected abstract RepositoryFactorySupport createRepositoryFactory()
Create the actual RepositoryFactorySupport instance.

Returns:

Spring Data Core

Copyright © 2011-2013-2013 Pivotal. All Rights Reserved.