Spring Data Commons

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:
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>

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()
           
 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 setCustomImplementation(Object customImplementation)
          Setter to inject a custom repository implementation.
 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

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:

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 Commons

Copyright © 2012. All Rights Reserved.