org.springframework.data.repository.config

## Class AnnotationRepositoryConfigurationSource

- java.lang.Object
- - org.springframework.data.repository.config.RepositoryConfigurationSourceSupport
  - - org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource

All Implemented Interfaces:
  RepositoryConfigurationSource

    public class AnnotationRepositoryConfigurationSource
    extends RepositoryConfigurationSourceSupport

Annotation based `RepositoryConfigurationSource`.

Author:
  Oliver Gierke, Thomas Darimont, Peter Rietzler, Jens Schauder, Mark Paluch

### Field Summary

### Fields inherited from class org.springframework.data.repository.config.RepositoryConfigurationSourceSupport

`DEFAULT_REPOSITORY_IMPL_POSTFIX`

### Constructor Summary

Constructors
Constructor and Description
`AnnotationRepositoryConfigurationSource(AnnotationMetadata metadata, Class<? extends Annotation> annotation, ResourceLoader resourceLoader, Environment environment, BeanDefinitionRegistry registry)` Deprecated. since 2.2. Prefer to use overload taking a `BeanNameGenerator` additionally.
`AnnotationRepositoryConfigurationSource(AnnotationMetadata metadata, Class<? extends Annotation> annotation, ResourceLoader resourceLoader, Environment environment, BeanDefinitionRegistry registry, BeanNameGenerator generator)` Creates a new `AnnotationRepositoryConfigurationSource` from the given `AnnotationMetadata` and annotation.

### Method Summary

All Methods Instance Methods Concrete Methods
`Optional<String>` `getAttribute(String name)` Returns the value for the `String` attribute with the given name.
`<T> Optional<T>` `getAttribute(String name, Class<T> type)` Returns the value for the attribute with the given name and type.
`AnnotationAttributes` `getAttributes()` Returns the `AnnotationAttributes` of the annotation configured.
`Streamable<String>` `getBasePackages()` Returns the base packages the repository interfaces shall be found under.
`BootstrapMode` `getBootstrapMode()` Defines the repository `BootstrapMode` to be used.
`AnnotationMetadata` `getEnableAnnotationMetadata()` Returns the `AnnotationMetadata` for the `@Enable` annotation that triggered the configuration.
`Streamable<TypeFilter>` `getExcludeFilters()` Return the `TypeFilter`s to define which types to exclude when scanning for repositories.
`protected Iterable<TypeFilter>` `getIncludeFilters()` Return the `TypeFilter`s to define which types to include when scanning for repositories.
`Optional<String>` `getNamedQueryLocation()`
`Optional<Object>` `getQueryLookupStrategyKey()` Returns the `QueryLookupStrategy.Key` to define how query methods shall be resolved.
`Optional<String>` `getRepositoryBaseClassName()` Returns the name of the repository base class to be used or `Optional.empty()` if the store specific defaults shall be applied.
`Optional<String>` `getRepositoryFactoryBeanClassName()` Returns the name of the repository factory bean class or `Optional.empty()` if not defined in the source.
`Optional<String>` `getRepositoryImplementationPostfix()` Returns the configured postfix to be used for looking up custom implementation classes.
`String` `getResourceDescription()` Returns a human readable description of the repository configuration source for error reporting purposes.
`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.
`boolean` `usesExplicitFilters()` Returns whether the configuration uses explicit filtering to scan for repository types.

### Methods inherited from class org.springframework.data.repository.config.RepositoryConfigurationSourceSupport

`generateBeanName, getCandidates, toImplementationDetectionConfiguration`

### 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.repository.config.RepositoryConfigurationSource

`getRequiredAttribute`

### Constructor Detail

#### AnnotationRepositoryConfigurationSource

    @Deprecated
    public AnnotationRepositoryConfigurationSource(AnnotationMetadata metadata,
                                                               Class<? extends Annotation> annotation,
                                                               ResourceLoader resourceLoader,
                                                               Environment environment,
                                                               BeanDefinitionRegistry registry)

Deprecated. since 2.2. Prefer to use overload taking a `BeanNameGenerator` additionally.
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` - must not be null.
  `registry` - must not be null.

#### AnnotationRepositoryConfigurationSource

    public AnnotationRepositoryConfigurationSource(AnnotationMetadata metadata,
                                                   Class<? extends Annotation> annotation,
                                                   ResourceLoader resourceLoader,
                                                   Environment environment,
                                                   BeanDefinitionRegistry registry,
                                                   @Nullable
                                                   BeanNameGenerator generator)

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` - must not be null.
  `registry` - must not be null.
  `generator` - can be null.

### Method Detail

#### getBasePackages

    public Streamable<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 Optional<Object> getQueryLookupStrategyKey()

Description copied from interface: `RepositoryConfigurationSource`
Returns the `QueryLookupStrategy.Key` to define how query methods shall be resolved.

Returns:

#### getNamedQueryLocation

    public Optional<String> getNamedQueryLocation()

Returns:

#### getRepositoryImplementationPostfix

    public Optional<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 `Optional.empty()` in case none is configured.

#### getSource

    @Nonnull
    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. @return.

#### getIncludeFilters

    protected Iterable<TypeFilter> getIncludeFilters()

Description copied from class: `RepositoryConfigurationSourceSupport`
Return the `TypeFilter`s 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

    public Streamable<TypeFilter> getExcludeFilters()

Description copied from class: `RepositoryConfigurationSourceSupport`
Return the `TypeFilter`s to define which types to exclude when scanning for repositories. Default implementation returns an empty collection.

Specified by:
  `getExcludeFilters` in interface `RepositoryConfigurationSource`
Overrides:
  `getExcludeFilters` in class `RepositoryConfigurationSourceSupport`
Returns:
  must not be null.

#### getRepositoryFactoryBeanClassName

    public Optional<String> getRepositoryFactoryBeanClassName()

Description copied from interface: `RepositoryConfigurationSource`
Returns the name of the repository factory bean class or `Optional.empty()` if not defined in the source.

Returns:

#### getRepositoryBaseClassName

    public Optional<String> getRepositoryBaseClassName()

Description copied from interface: `RepositoryConfigurationSource`
Returns the name of the repository base class to be used or `Optional.empty()` if the store specific defaults shall be applied.

Returns:

#### getAttributes

    public AnnotationAttributes getAttributes()

Returns the `AnnotationAttributes` of the annotation configured.

Returns:
  the attributes will never be null.

#### getEnableAnnotationMetadata

    public AnnotationMetadata getEnableAnnotationMetadata()

Returns the `AnnotationMetadata` for the `@Enable` annotation that triggered the configuration.

Returns:
  the enableAnnotationMetadata

#### 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 Optional<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 `Optional.empty()` if not configured or empty.

#### getAttribute

    public <T> Optional<T> getAttribute(String name,
                                        Class<T> type)

Description copied from interface: `RepositoryConfigurationSource`
Returns the value for the attribute with the given name and type. The name is expected to be handed in camel-case.

Parameters:
  `name` - must not be null or empty.
  `type` - the type of the attribute to look up.
Returns:
  the attribute with the given name or `Optional.empty()` if not configured or empty.

#### usesExplicitFilters

    public boolean usesExplicitFilters()

Description copied from interface: `RepositoryConfigurationSource`
Returns whether the configuration uses explicit filtering to scan for repository types.

Returns:
  whether the configuration uses explicit filtering to scan for repository types.

#### getBootstrapMode

    public BootstrapMode getBootstrapMode()

Description copied from interface: `RepositoryConfigurationSource`
Defines the repository `BootstrapMode` to be used.

Returns:

#### getResourceDescription

    public String getResourceDescription()

Description copied from interface: `RepositoryConfigurationSource`
Returns a human readable description of the repository configuration source for error reporting purposes.

Returns:
  can be null.