public class RepositoryFactoryBuilder extends Object implements Start, DataFunctionsAnd, DataStoresAnd, EventListenerAnd, MappingContextAnd, OperatorsAnd, ResultAdaptersAnd, OperationHandlersAnd
| Modifier and Type | Class and Description |
|---|---|
static class |
RepositoryFactoryBuilder.DefaultAuditorAware
An auditor aware that returns the static value of
DEFAULT_USER |
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_USER |
| Modifier and Type | Method and Description |
|---|---|
<E> ResultAdaptersAnd |
adaptResultsUsing(ResultAdapter<E> adapter)
Tells the build to register a result adapter
|
MappingContextAnd |
and(Class<?> superType,
Class<?> implementation)
Registers an additional mapping
|
<E,K extends Serializable> |
and(DataStore<K,E> dataStore)
Adds another data store
|
<E extends DataStoreEvent> |
and(DataStoreEventListener<E> listener)
Registers an extra event listener
|
OperationHandlersAnd |
and(NonDataOperationHandler handler)
Registers an extra operation handler
|
OperatorsAnd |
and(Operator operator)
Registers this operator as well
|
<E> ResultAdaptersAnd |
and(ResultAdapter<E> adapter)
Registers an extra adapter
|
<R> DataFunctionsAnd |
and(String name,
DataFunction<R> function)
adds an additional function
|
RepositoryFactory |
build() |
static Start |
builder()
Starting point for writing code in the builder's DSL
|
RepositoryFactoryConfiguration |
configure() |
static RepositoryFactoryConfiguration |
defaultConfiguration() |
static RepositoryFactory |
defaultFactory() |
EventListener |
enableAuditing()
Enables auditing by setting the auditor to
the default
value. |
EventListener |
enableAuditing(org.springframework.data.domain.AuditorAware auditorAware)
Enables auditing by using the provided auditor aware
|
DataFunctions |
extractQueriesUsing(MethodQueryDescriptionExtractor extractor)
Tells the builder to use the given query description extractor instead of the default
|
<S extends Serializable,G extends KeyGenerator<S>> |
generateKeysUsing(Class<G> generatorType)
Sets the key generator to an instance of the provided type.
|
<S extends Serializable> |
generateKeysUsing(KeyGenerator<S> keyGenerator)
Sets the key generator to the provided instance
|
static Start |
given(RepositoryFactoryConfiguration configuration)
Start the configuration DSL by considering the provided configuration as
the default fallback
|
MappingContextAnd |
honoringImplementation(Class<?> superType,
Class<?> implementation)
Tells the builder to register a mapping
|
<E> E |
mock(Class<E> repositoryInterface)
Tells the builder that it is now time to mock the given repository interface using the configuration provided
thus far.
|
<E,K extends Serializable> |
registerDataStore(DataStore<K,E> dataStore)
Registers a new data store
|
<R> DataFunctionsAnd |
registerFunction(String name,
DataFunction<R> function)
Registers a function and lets you add more functions
|
OperatorsAnd |
registerOperator(Operator operator)
Registers the given operator in the context used by the builder
|
QueryDescriptionConfigurer |
resolveMetadataUsing(RepositoryMetadataResolver metadataResolver)
Tells the builder to use the given repository metadata resolver instead of the default it has
|
ImplementationAnd |
usingImplementation(Class<?> implementation)
Tells the builder to use the given implementation
|
MappingContext |
withAdapters(ResultAdapterContext context)
Tells the builder to use the provided context
|
DataStores |
withDataFunctions(DataFunctionRegistry registry)
Tells the builder which data function registry it should use
|
ResultAdapters |
withDataStores(DataStoreRegistry registry)
Tells the builder to use a different registry
|
EventListener |
withDefaultKeyGenerator(KeyGenerator<? extends Serializable> keyGenerator)
Sets up a default key generator that would be used as a fallback if no key generation scheme is specified for the
repository
|
<E extends DataStoreEvent> |
withListener(DataStoreEventListener<E> listener)
Tells the context to register this listener
|
End |
withListeners(DataStoreEventListenerContext context)
Tells the build to use this listener context
|
EventListener |
withMappings(TypeMappingContext context)
Tells the builder to use the provided context
|
OperationHandlersAnd |
withOperationHandler(NonDataOperationHandler handler)
Registers an operation handler
|
FallbackKeyGenerator |
withOperationHandlers(NonDataOperationInvocationHandler invocationHandler)
Sets the invocation handler used for handling non-data-related operations
|
DataFunctions |
withOperators(OperatorContext context)
Tells the builder to use the provided context instead of its own context
|
Implementation |
withoutGeneratingKeys()
Tells the builder that we are not going to have any auto-generated keys
|
public static final String DEFAULT_USER
public static RepositoryFactoryConfiguration defaultConfiguration()
public static Start builder()
public static Start given(RepositoryFactoryConfiguration configuration)
configuration - the fallback configurationpublic static RepositoryFactory defaultFactory()
public QueryDescriptionConfigurer resolveMetadataUsing(RepositoryMetadataResolver metadataResolver)
MetadataResolverresolveMetadataUsing in interface MetadataResolvermetadataResolver - the resolver to usepublic DataFunctions withOperators(OperatorContext context)
OperatorswithOperators in interface Operatorscontext - the contextpublic OperatorsAnd registerOperator(Operator operator)
OperatorsregisterOperator in interface Operatorsoperator - the operatorpublic DataFunctions extractQueriesUsing(MethodQueryDescriptionExtractor extractor)
QueryDescriptionextractQueriesUsing in interface QueryDescriptionextractor - the extractorpublic DataStores withDataFunctions(DataFunctionRegistry registry)
DataFunctionswithDataFunctions in interface DataFunctionsregistry - the registry that should be usedpublic <R> DataFunctionsAnd registerFunction(String name, DataFunction<R> function)
DataFunctionsregisterFunction in interface DataFunctionsR - the type of the resultname - the name under which this function is recognizedfunction - the functionpublic ResultAdapters withDataStores(DataStoreRegistry registry)
DataStoreswithDataStores in interface DataStoresregistry - the registrypublic <E,K extends Serializable> DataStoresAnd registerDataStore(DataStore<K,E> dataStore)
DataStoresregisterDataStore in interface DataStoresE - the entity typeK - the key typedataStore - the data storepublic MappingContext withAdapters(ResultAdapterContext context)
ResultAdapterswithAdapters in interface ResultAdapterscontext - the contextpublic <E> ResultAdaptersAnd adaptResultsUsing(ResultAdapter<E> adapter)
ResultAdaptersadaptResultsUsing in interface ResultAdaptersE - the type of the result for the adapteradapter - the adapterpublic EventListener withMappings(TypeMappingContext context)
MappingContextwithMappings in interface MappingContextcontext - the contextpublic MappingContextAnd honoringImplementation(Class<?> superType, Class<?> implementation)
MappingContexthonoringImplementation in interface MappingContextsuperType - the super type for the repository interfaceimplementation - the concrete class implementing the mapped methodspublic FallbackKeyGenerator withOperationHandlers(NonDataOperationInvocationHandler invocationHandler)
OperationHandlerswithOperationHandlers in interface OperationHandlersinvocationHandler - the invocation handlerpublic OperationHandlersAnd withOperationHandler(NonDataOperationHandler handler)
OperationHandlerswithOperationHandler in interface OperationHandlershandler - the handlerpublic End withListeners(DataStoreEventListenerContext context)
EventListenerwithListeners in interface EventListenercontext - the contextpublic <E extends DataStoreEvent> EventListenerAnd withListener(DataStoreEventListener<E> listener)
EventListenerwithListener in interface EventListenerE - the (super-)type of the events the listener is going to react tolistener - the listenerpublic EventListener enableAuditing(org.springframework.data.domain.AuditorAware auditorAware)
AuditingenableAuditing in interface AuditingauditorAware - the auditor aware providing auditorpublic EventListener enableAuditing()
Auditingthe default
value.enableAuditing in interface Auditingpublic <R> DataFunctionsAnd and(String name, DataFunction<R> function)
DataFunctionsAndand in interface DataFunctionsAndR - the type of the resultname - the name of the functionfunction - the functionpublic <E,K extends Serializable> DataStoresAnd and(DataStore<K,E> dataStore)
DataStoresAndand in interface DataStoresAndE - the type of the entityK - the type of the keydataStore - the data storepublic OperationHandlersAnd and(NonDataOperationHandler handler)
OperationHandlersAndand in interface OperationHandlersAndhandler - the handlerpublic EventListener withDefaultKeyGenerator(KeyGenerator<? extends Serializable> keyGenerator)
FallbackKeyGeneratorwithDefaultKeyGenerator in interface FallbackKeyGeneratorkeyGenerator - the key generator to be usedpublic <E extends DataStoreEvent> EventListenerAnd and(DataStoreEventListener<E> listener)
EventListenerAndand in interface EventListenerAndE - the type of the events the listener is subscribed tolistener - the listenerpublic MappingContextAnd and(Class<?> superType, Class<?> implementation)
MappingContextAndand in interface MappingContextAndsuperType - the super type for the interfaceimplementation - the concrete class providing mapped method implementationspublic OperatorsAnd and(Operator operator)
OperatorsAndand in interface OperatorsAndoperator - the operatorpublic <E> ResultAdaptersAnd and(ResultAdapter<E> adapter)
ResultAdaptersAndand in interface ResultAdaptersAndE - the type of the result for the adapteradapter - the adapterpublic RepositoryFactory build()
for configuration options.public RepositoryFactoryConfiguration configure()
repository factory configuration instance that has
been created as a result of method calls via this DSLpublic <S extends Serializable> Implementation generateKeysUsing(KeyGenerator<S> keyGenerator)
KeyGenerationgenerateKeysUsing in interface KeyGenerationS - the type of the keyskeyGenerator - the key generatorpublic <S extends Serializable,G extends KeyGenerator<S>> Implementation generateKeysUsing(Class<G> generatorType)
KeyGenerationgenerateKeysUsing in interface KeyGenerationS - the type of the keys the generator will be generatingG - the type of the generatorgeneratorType - the type of the key generator to usepublic Implementation withoutGeneratingKeys()
KeyGenerationwithoutGeneratingKeys in interface KeyGenerationpublic ImplementationAnd usingImplementation(Class<?> implementation)
ImplementationusingImplementation in interface Implementationimplementation - the implementationCopyright © 2014–2016. All rights reserved.