public class DefaultDataProviderFactory extends AbstractDataProviderFactory
DataProvider from the class path.
Each found non abstract class extending DataProvider is instantiated:
@Resource are initiated.@PostConstruct are invoked.registered.EntityImporter - the importer itselfFile - the data directory from the command line resp. from the property
EntityImporter.DATA_FOLDER_KEY.Properties - the settings of the EntityImporterDataProvider - another provider, will throw an exception, if the given provider depends on the new
oneEntityImporter.PACKAGES_KEY. In addition one can define one or more data providers in the file
/META-INF/services/org.fastnate.data.DataProvider.| Modifier and Type | Class and Description |
|---|---|
private static class |
DefaultDataProviderFactory.MaxOrder |
| Constructor and Description |
|---|
DefaultDataProviderFactory() |
| Modifier and Type | Method and Description |
|---|---|
protected <C extends DataProvider> |
addProvider(EntityImporter importer,
Class<C> providerClass)
Tries to instantiate the provider from the given class.
|
protected <C extends DataProvider> |
addProvider(EntityImporter importer,
Constructor<C> constructor)
Tries to create a provider using the given constructor and adds it to list of providers in the
EntityImporter. |
void |
createDataProviders(EntityImporter importer)
Discovers, builds and registers all
DataProviders that are available for the current environment. |
private <E> E |
findDependency(EntityImporter importer,
Class<E> parameterType,
DefaultDataProviderFactory.MaxOrder maxOrder) |
private boolean |
findResourceFields(EntityImporter importer,
Class<?> instanceClass,
List<Consumer<DataProvider>> resources,
DefaultDataProviderFactory.MaxOrder maxOrder) |
private boolean |
findResourceSetters(EntityImporter importer,
Class<?> instanceClass,
List<Consumer<DataProvider>> resources,
Set<String> injectedMethods,
DefaultDataProviderFactory.MaxOrder maxOrder) |
private void |
invokePostConstruct(Class<?> instanceClass,
Set<String> calledMethods,
DataProvider provider) |
buildReflections, findImporterDependency, findProviderClassesprotected <C extends DataProvider> C addProvider(EntityImporter importer, Class<C> providerClass)
importer - the current importer that will be used with that providerproviderClass - the class of the provider to instantiatenull if the given class has no appropriate constructorprotected <C extends DataProvider> C addProvider(EntityImporter importer, Constructor<C> constructor)
EntityImporter.importer - the current instance of the importer for adding the new providerconstructor - the constructor of the new providernull if the given constructor is not appropriatepublic void createDataProviders(EntityImporter importer)
DataProviderFactoryDataProviders that are available for the current environment.
Ensures that the order of the providers is set in accordance with their dependencies.importer - the current importer that needs the providers, new providers are added with
EntityImporter.addDataProvider(DataProvider) or
EntityImporter.addDataProvider(DataProvider, int)private <E> E findDependency(EntityImporter importer, Class<E> parameterType, DefaultDataProviderFactory.MaxOrder maxOrder)
private boolean findResourceFields(EntityImporter importer, Class<?> instanceClass, List<Consumer<DataProvider>> resources, DefaultDataProviderFactory.MaxOrder maxOrder)
private boolean findResourceSetters(EntityImporter importer, Class<?> instanceClass, List<Consumer<DataProvider>> resources, Set<String> injectedMethods, DefaultDataProviderFactory.MaxOrder maxOrder)
private void invokePostConstruct(Class<?> instanceClass, Set<String> calledMethods, DataProvider provider)
Copyright © 2022 fastnate.org. All rights reserved.