クラス RepositoryFactorySupport
java.lang.ObjectSE
org.springframework.data.repository.core.support.RepositoryFactorySupport
- 実装されたすべてのインターフェース:
Aware
、BeanClassLoaderAware
、BeanFactoryAware
- 既知の直属サブクラス
ReactiveRepositoryFactorySupport
public abstract class RepositoryFactorySupport
extends ObjectSE
implements BeanClassLoaderAware, BeanFactoryAware
Bean をファクトリ化して、特定のリポジトリインターフェースのインスタンスを作成します。構成されたリポジトリインターフェースを実装するプロキシを作成し、コントロールを
QueryExecutorMethodInterceptor
に渡すアドバイスを適用します。クエリ検出戦略は、QueryLookupStrategy.Key
を設定することで構成できます。- 作成者:
- Oliver Gierke, Mark Paluch, Christoph Strobl, Jens Schauder, John Blum, Johannes Englmeier
コンストラクターのサマリー
コンストラクターメソッドのサマリー
修飾子と型メソッド説明void
RepositoryMethodInvocationListener
をファクトリに追加して、query methods
およびfragment methods
SE の実行直後にトリガーされる機能をプラグインします。void
addQueryCreationListener
(QueryCreationListener<?> listener) QueryCreationListener
をファクトリに追加して、RepositoryQuery
インスタンスの作成直後にトリガーされる機能をプラグインします。void
RepositoryProxyPostProcessor
をファクトリに追加して、プロキシが作成される前にProxyFactory
を操作できるようにします。abstract <T,
ID> EntityInformation<T, ID> getEntityInformation
(ClassSE<T> domainClass) 指定されたドメインクラスのEntityInformation
を返します。protected ProjectionFactory
ProjectionFactory
インスタンスを返します。protected ProjectionFactory
getProjectionFactory
(ClassLoaderSE classLoader, BeanFactory beanFactory) 作成されたリポジトリインスタンスで使用するProjectionFactory
を返します。protected OptionalSE<QueryLookupStrategy>
getQueryLookupStrategy
(QueryLookupStrategy.Key key, QueryMethodEvaluationContextProvider evaluationContextProvider) protected ListSE<QueryMethod>
<T> T
getRepository
(ClassSE<T> repositoryInterface) 指定されたインターフェースのリポジトリインスタンスを返します。<T> T
getRepository
(ClassSE<T> repositoryInterface, ObjectSE customImplementation) カスタムロジックの実装ロジックを提供する単一のインスタンスによる、指定されたインターフェースのリポジトリインスタンスを返します。<T> T
getRepository
(ClassSE<T> repositoryInterface, RepositoryComposition.RepositoryFragments fragments) カスタムロジックの実装ロジックを提供するインスタンスによって裏付けられた、指定されたインターフェースのリポジトリインスタンスを返します。protected abstract ClassSE<?>
getRepositoryBaseClass
(RepositoryMetadata metadata) 実際のリポジトリインスタンスをバッキングする基本クラスを返します。getRepositoryFragments
(RepositoryMetadata metadata) RepositoryMetadata
に基づいてRepositoryComposition.RepositoryFragments
を作成し、リポジトリ固有の拡張機能を追加します。protected RepositoryInformation
getRepositoryInformation
(RepositoryMetadata metadata, RepositoryComposition.RepositoryFragments fragments) 指定されたRepositoryMetadata
およびカスタムRepositoryComposition.RepositoryFragments
のRepositoryInformation
を返します。protected RepositoryMetadata
getRepositoryMetadata
(ClassSE<?> repositoryInterface) 指定されたリポジトリインターフェースのRepositoryMetadata
を返します。protected abstract ObjectSE
getTargetRepository
(RepositoryInformation metadata) クエリプロキシのバッキングとしてリポジトリインスタンスを作成します。protected final <R> R
getTargetRepositoryViaReflection
(ClassSE<?> baseClass, ObjectSE... constructorArguments) 使用すべきではありません。紛らわしい名前を持っているため、2.6 以降。protected final <R> R
getTargetRepositoryViaReflection
(RepositoryInformation information, ObjectSE... constructorArguments) リフレクションを使用して、指定されたRepositoryInformation
で定義されたリポジトリ基本クラスのリポジトリを作成します。protected final <R> R
instantiateClass
(ClassSE<?> baseClass, ObjectSE... constructorArguments) 一致するコンストラクターを検索することにより、指定されたconstructorArguments
を使用してクラスをインスタンス化するための便利なメソッド。void
setBeanClassLoader
(ClassLoaderSE classLoader) void
setBeanFactory
(BeanFactory beanFactory) void
setEvaluationContextProvider
(QueryMethodEvaluationContextProvider evaluationContextProvider) 手動で定義されたクエリで SpEL 式を評価するために使用されるQueryMethodEvaluationContextProvider
を設定します。void
setNamedQueries
(NamedQueries namedQueries) クエリ作成のためにQueryLookupStrategy
に渡されるNamedQueries
インスタンスを構成します。void
ファインダーを実行するためのクエリの検索方法の戦略を設定します。void
setRepositoryBaseClass
(ClassSE<?> repositoryBaseClass) リポジトリプロキシの作成時に使用するリポジトリ基本クラスを構成します。protected void
validate
(RepositoryMetadata repositoryMetadata)
コンストラクターの詳細
RepositoryFactorySupport
public RepositoryFactorySupport()
メソッドの詳細
setQueryLookupStrategyKey
ファインダーを実行するためのクエリの検索方法の戦略を設定します。- パラメーター:
key
-
setNamedQueries
クエリ作成のためにQueryLookupStrategy
に渡されるNamedQueries
インスタンスを構成します。- パラメーター:
namedQueries
- 設定する namedQueries
setBeanClassLoader
- 次で指定:
- インターフェース
BeanClassLoaderAware
のsetBeanClassLoader
setBeanFactory
- 次で指定:
- インターフェース
BeanFactoryAware
のsetBeanFactory
- 例外:
BeansException
setEvaluationContextProvider
public void setEvaluationContextProvider(QueryMethodEvaluationContextProvider evaluationContextProvider) 手動で定義されたクエリで SpEL 式を評価するために使用されるQueryMethodEvaluationContextProvider
を設定します。- パラメーター:
evaluationContextProvider
- null にすることができ、デフォルトはQueryMethodEvaluationContextProvider.DEFAULT
です。
setRepositoryBaseClass
リポジトリプロキシの作成時に使用するリポジトリ基本クラスを構成します。設定されていない場合、ファクトリはデフォルトでgetRepositoryBaseClass(RepositoryMetadata)
によって返される型を使用します。- パラメーター:
repositoryBaseClass
- リポジトリプロキシをサポートするリポジトリの基本クラス。null でもかまいません。- 導入:
- 1.11
addQueryCreationListener
QueryCreationListener
をファクトリに追加して、RepositoryQuery
インスタンスの作成直後にトリガーされる機能をプラグインします。- パラメーター:
listener
-
addInvocationListener
RepositoryMethodInvocationListener
をファクトリに追加して、query methods
およびfragment methods
SE の実行直後にトリガーされる機能をプラグインします。- パラメーター:
listener
-- 導入:
- 2.4
addRepositoryProxyPostProcessor
RepositoryProxyPostProcessor
をファクトリに追加して、プロキシが作成される前にProxyFactory
を操作できるようにします。RepositoryProxyPostProcessor
が考慮された後、QueryExecutorMethodInterceptor
がプロキシに追加されることに注意してください。- パラメーター:
processor
-
getRepositoryFragments
protected RepositoryComposition.RepositoryFragments getRepositoryFragments(RepositoryMetadata metadata) RepositoryMetadata
に基づいてRepositoryComposition.RepositoryFragments
を作成し、リポジトリ固有の拡張機能を追加します。- パラメーター:
metadata
-- 戻り値:
getRepository
指定されたインターフェースのリポジトリインスタンスを返します。- パラメーター:
repositoryInterface
- null であってはなりません。- 戻り値:
getRepository
カスタムロジックの実装ロジックを提供する単一のインスタンスによってサポートされる、指定されたインターフェースのリポジトリインスタンスを返します。より高度な構成が必要な場合は、getRepository(Class, RepositoryFragments)
を使用してください。- パラメーター:
repositoryInterface
- null であってはなりません。customImplementation
- null であってはなりません。- 戻り値:
getRepository
public <T> T getRepository(ClassSE<T> repositoryInterface, RepositoryComposition.RepositoryFragments fragments) カスタムロジックの実装ロジックを提供するインスタンスによって裏付けられた、指定されたインターフェースのリポジトリインスタンスを返します。- パラメーター:
repositoryInterface
- null であってはなりません。fragments
- null であってはなりません。- 戻り値:
- 導入:
- 2.0
getProjectionFactory
protected ProjectionFactory getProjectionFactory(ClassLoaderSE classLoader, BeanFactory beanFactory) 作成されたリポジトリインスタンスで使用するProjectionFactory
を返します。- パラメーター:
classLoader
- null になることはありません。beanFactory
- null になることはありません。- 戻り値:
- null になることはありません。
getRepositoryMetadata
指定されたリポジトリインターフェースのRepositoryMetadata
を返します。- パラメーター:
repositoryInterface
- null になることはありません。- 戻り値:
getRepositoryInformation
protected RepositoryInformation getRepositoryInformation(RepositoryMetadata metadata, RepositoryComposition.RepositoryFragments fragments) 指定されたRepositoryMetadata
およびカスタムRepositoryComposition.RepositoryFragments
のRepositoryInformation
を返します。- パラメーター:
metadata
- null であってはなりません。fragments
- null であってはなりません。- 戻り値:
- null になることはありません。
getQueryMethods
getProjectionFactory
ProjectionFactory
インスタンスを返します。- 戻り値:
- 導入:
- 2.6
getEntityInformation
指定されたドメインクラスのEntityInformation
を返します。- 型パラメーター:
T
- エンティティ型ID
- ID 型- パラメーター:
domainClass
-- 戻り値:
getTargetRepository
クエリプロキシのバッキングとしてリポジトリインスタンスを作成します。- パラメーター:
metadata
-- 戻り値:
getRepositoryBaseClass
実際のリポジトリインスタンスをバッキングする基本クラスを返します。getTargetRepository(RepositoryInformation)
がこのクラスのインスタンスを返すことを確認してください。- パラメーター:
metadata
-- 戻り値:
getQueryLookupStrategy
protected OptionalSE<QueryLookupStrategy> getQueryLookupStrategy(@Nullable QueryLookupStrategy.Key key, QueryMethodEvaluationContextProvider evaluationContextProvider) - パラメーター:
key
- null でもかまいません。evaluationContextProvider
- null になることはありません。- 戻り値:
- 使用する
QueryLookupStrategy
。クエリを検索する必要がない場合は null。 - 導入:
- 1.9
validate
getTargetRepositoryViaReflection
protected final <R> R getTargetRepositoryViaReflection(RepositoryInformation information, ObjectSE... constructorArguments) リフレクションを使用して、指定されたRepositoryInformation
で定義されたリポジトリ基本クラスのリポジトリを作成します。- パラメーター:
information
-constructorArguments
-- 戻り値:
getTargetRepositoryViaReflection
@DeprecatedSE protected final <R> R getTargetRepositoryViaReflection(ClassSE<?> baseClass, ObjectSE... constructorArguments) 使用すべきではありません。2.6 以降、誤解を招く名前が付けられているためです。代わりにinstantiateClass(Class, Object...)
を使用してください。リフレクションを使用して、指定されたRepositoryInformation
で定義されたリポジトリ基本クラスのリポジトリを作成します。- パラメーター:
baseClass
-constructorArguments
-- 戻り値:
instantiateClass
一致するコンストラクターを検索することにより、指定されたconstructorArguments
を使用してクラスをインスタンス化するための便利なメソッド。このメソッドは、アクセスできない(つまり、非パブリック)コンストラクターが指定された場合、コンストラクターをアクセス可能に設定しようとし、オプションのパラメーターとデフォルト値を持つ Kotlin クラスをサポートすることに注意してください。
- パラメーター:
baseClass
-constructorArguments
-- 戻り値:
- 導入:
- 2.6