Spring Data Core

org.springframework.data.repository.config
Class AnnotationRepositoryConfigurationSource

java.lang.Object
  extended by org.springframework.data.repository.config.RepositoryConfigurationSourceSupport
      extended by org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource
All Implemented Interfaces:
RepositoryConfigurationSource

public class AnnotationRepositoryConfigurationSource
extends RepositoryConfigurationSourceSupport

Annotation based RepositoryConfigurationSource.

Author:
Oliver Gierke, Thomas Darimont

Field Summary
 
Fields inherited from class org.springframework.data.repository.config.RepositoryConfigurationSourceSupport
DEFAULT_REPOSITORY_IMPL_POSTFIX
 
Constructor Summary
AnnotationRepositoryConfigurationSource(AnnotationMetadata metadata, Class<? extends Annotation> annotation, ResourceLoader resourceLoader, Environment environment)
          Creates a new AnnotationRepositoryConfigurationSource from the given AnnotationMetadata and annotation.
 
Method Summary
 String getAttribute(String name)
          Returns the value for the String attribute with the given name.
 AnnotationAttributes getAttributes()
          Returns the AnnotationAttributes of the annotation configured.
 Iterable<String> getBasePackages()
          Returns the base packages the repository interfaces shall be found under.
protected  Iterable<TypeFilter> getExcludeFilters()
          Return the TypeFilters to define which types to exclude when scanning for repositories.
protected  Iterable<TypeFilter> getIncludeFilters()
          Return the TypeFilters to define which types to include when scanning for repositories.
 String getNamedQueryLocation()
           
 Object getQueryLookupStrategyKey()
          Returns the QueryLookupStrategy.Key to define how query methods shall be resolved.
 String getRepositoryFactoryBeanName()
          Returns the name of the class of the FactoryBean to actually create repository instances.
 String getRepositoryImplementationPostfix()
          Returns the configured postfix to be used for looking up custom implementation classes.
 Object getSource()
          Returns the actual source object that the configuration originated from.
 boolean shouldConsiderNestedRepositories()
          Returns whether we should consider nested repositories, i.e. repository interface definitions nested in other classes.
 
Methods inherited from class org.springframework.data.repository.config.RepositoryConfigurationSourceSupport
getCandidates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationRepositoryConfigurationSource

public AnnotationRepositoryConfigurationSource(AnnotationMetadata metadata,
                                               Class<? extends Annotation> annotation,
                                               ResourceLoader resourceLoader,
                                               Environment environment)
Creates a new AnnotationRepositoryConfigurationSource from the given AnnotationMetadata and annotation.

Parameters:
metadata - must not be null.
annotation - must not be null.
resourceLoader - must not be null.
environment -
Method Detail

getBasePackages

public Iterable<String> getBasePackages()
Description copied from interface: RepositoryConfigurationSource
Returns the base packages the repository interfaces shall be found under.

Returns:
must not be null.

getQueryLookupStrategyKey

public Object getQueryLookupStrategyKey()
Description copied from interface: RepositoryConfigurationSource
Returns the QueryLookupStrategy.Key to define how query methods shall be resolved.

Returns:

getNamedQueryLocation

public String getNamedQueryLocation()
Returns:

getRepositoryImplementationPostfix

public String getRepositoryImplementationPostfix()
Description copied from interface: RepositoryConfigurationSource
Returns the configured postfix to be used for looking up custom implementation classes.

Returns:
the postfix to use or null in case none is configured.

getSource

public Object getSource()
Description copied from interface: RepositoryConfigurationSource
Returns the actual source object that the configuration originated from. Will be used by the tooling to give visual feedback on where the repository instances actually come from.

Returns:
must not be null.

getIncludeFilters

protected Iterable<TypeFilter> getIncludeFilters()
Description copied from class: RepositoryConfigurationSourceSupport
Return the TypeFilters to define which types to include when scanning for repositories. Default implementation returns an empty collection.

Overrides:
getIncludeFilters in class RepositoryConfigurationSourceSupport
Returns:
must not be null.

getExcludeFilters

protected Iterable<TypeFilter> getExcludeFilters()
Description copied from class: RepositoryConfigurationSourceSupport
Return the TypeFilters to define which types to exclude when scanning for repositories. Default implementation returns an empty collection.

Overrides:
getExcludeFilters in class RepositoryConfigurationSourceSupport
Returns:
must not be null.

getRepositoryFactoryBeanName

public String getRepositoryFactoryBeanName()
Description copied from interface: RepositoryConfigurationSource
Returns the name of the class of the FactoryBean to actually create repository instances.

Returns:

getAttributes

public AnnotationAttributes getAttributes()
Returns the AnnotationAttributes of the annotation configured.

Returns:
the attributes will never be null.

shouldConsiderNestedRepositories

public boolean shouldConsiderNestedRepositories()
Description copied from class: RepositoryConfigurationSourceSupport
Returns whether we should consider nested repositories, i.e. repository interface definitions nested in other classes.

Overrides:
shouldConsiderNestedRepositories in class RepositoryConfigurationSourceSupport
Returns:
true if the container should look for nested repository interface definitions.

getAttribute

public String getAttribute(String name)
Description copied from interface: RepositoryConfigurationSource
Returns the value for the String attribute with the given name. The name is expected to be handed in camel-case.

Parameters:
name - must not be null or empty.
Returns:
the attribute with the given name or null if not configured or empty.

Spring Data Core

Copyright © 2011-2014–2014 Pivotal Software, Inc.. All rights reserved.