/*
 * Copyright 2012-2020 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.springframework.data.repository.config;

import java.util.Optional;

import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.core.type.filter.TypeFilter;
import org.springframework.data.repository.query.QueryLookupStrategy;
import org.springframework.data.util.Streamable;
import org.springframework.lang.Nullable;

Configuration information for a single repository instance.
Author:Oliver Gierke, Mark Paluch
/** * Configuration information for a single repository instance. * * @author Oliver Gierke * @author Mark Paluch */
public interface RepositoryConfiguration<T extends RepositoryConfigurationSource> {
Returns the base packages that the repository was scanned under.
Returns:
/** * Returns the base packages that the repository was scanned under. * * @return */
Streamable<String> getBasePackages();
Returns the base packages to scan for repository implementations.
Returns:
Since:2.0
/** * Returns the base packages to scan for repository implementations. * * @return * @since 2.0 */
Streamable<String> getImplementationBasePackages();
Returns the interface name of the repository.
Returns:
/** * Returns the interface name of the repository. * * @return */
String getRepositoryInterface();
Returns the key to resolve a QueryLookupStrategy from eventually.
See Also:
Returns:
/** * Returns the key to resolve a {@link QueryLookupStrategy} from eventually. * * @see QueryLookupStrategy.Key * @return */
Object getQueryLookupStrategyKey();
Returns the location of the file containing Spring Data named queries.
Returns:
/** * Returns the location of the file containing Spring Data named queries. * * @return */
Optional<String> getNamedQueriesLocation();
Returns the name of the repository base class to be used or null if the store specific defaults shall be applied.
Returns:
Since:1.11
/** * Returns the name of the repository base class to be used or {@literal null} if the store specific defaults shall be * applied. * * @return * @since 1.11 */
Optional<String> getRepositoryBaseClassName();
Returns the name of the repository factory bean class to be used.
Returns:
/** * Returns the name of the repository factory bean class to be used. * * @return */
String getRepositoryFactoryBeanClassName();
Returns the source of the RepositoryConfiguration.
Returns:
/** * Returns the source of the {@link RepositoryConfiguration}. * * @return */
@Nullable Object getSource();
Returns:
/** * Returns the {@link RepositoryConfigurationSource} that backs the {@link RepositoryConfiguration}. * * @return */
T getConfigurationSource();
Returns whether to initialize the repository proxy lazily.
Returns:
/** * Returns whether to initialize the repository proxy lazily. * * @return */
boolean isLazyInit();
Returns whether the repository is the primary one for its type.
Returns:true whether the repository is the primary one for its type.
Since:2.2.1
/** * Returns whether the repository is the primary one for its type. * * @return {@literal true} whether the repository is the primary one for its type. * @since 2.2.1 */
boolean isPrimary();
Returns the TypeFilters to be used to exclude packages from repository scanning.
Returns:
/** * Returns the {@link TypeFilter}s to be used to exclude packages from repository scanning. * * @return */
Streamable<TypeFilter> getExcludeFilters();
Returns the ImplementationDetectionConfiguration to be used for this repository.
Params:
  • factory – must not be null.
Returns:will never be null.
Since:2.1
/** * Returns the {@link ImplementationDetectionConfiguration} to be used for this repository. * * @param factory must not be {@literal null}. * @return will never be {@literal null}. * @since 2.1 */
ImplementationDetectionConfiguration toImplementationDetectionConfiguration(MetadataReaderFactory factory);
Params:
  • factory – must not be null.
Returns:will never be null.
Since:2.1
/** * Returns the {@link ImplementationLookupConfiguration} for the given {@link MetadataReaderFactory}. * * @param factory must not be {@literal null}. * @return will never be {@literal null}. * @since 2.1 */
ImplementationLookupConfiguration toLookupConfiguration(MetadataReaderFactory factory); }