public abstract class GenericDataProvider extends Object implements DataProvider
$dataFolder/entities that match a
specific pattern.
The subclasses define the pattern (and type) of the imported files.| Modifier and Type | Field and Description |
|---|---|
private org.fastnate.generator.context.GeneratorContext |
context
The context of the current generator, with the description of the entity classes and settings.
|
private DataFolder |
dataFolder
The data folder defined for the entity importer.
|
private List<Collection<?>> |
entities
The entities as returned from the importers, to prevent useless allocation of another list.
|
private static String |
ENTITIES_FOLDER
The folder in the
dataFolder that contains the entity files. |
private EntityRegistration |
entityRegistration
Contains all already discovered entities with their unique property.
|
private static org.slf4j.Logger |
log |
| Constructor and Description |
|---|
GenericDataProvider() |
| Modifier and Type | Method and Description |
|---|---|
void |
buildEntities()
Builds the entities that are accessed later using
DataProvider.writeEntities(EntitySqlGenerator). |
protected org.fastnate.generator.context.EntityClass<?> |
findEntityClass(DataFile importFile)
Tries to guess the class of the imported entities from the file or directory name.
|
protected org.fastnate.generator.context.GeneratorContext |
getContext()
The context of the current generator, with the description of the entity classes and settings.
|
protected EntityRegistration |
getEntityRegistration()
Contains all already discovered entities with their unique property.
|
protected abstract Collection<?> |
importFile(DataFile importFile)
Tries to import the given file.
|
protected abstract boolean |
isImportFile(DataFile file)
Indicates that the given file is imported.
|
private void |
readImportFile(DataFile file) |
void |
writeEntities(org.fastnate.generator.EntitySqlGenerator sqlGenerator)
Adds all
entities to the SQL file using the given generator. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetOrderprivate static final org.slf4j.Logger log
private static final String ENTITIES_FOLDER
dataFolder that contains the entity files.private org.fastnate.generator.context.GeneratorContext context
private EntityRegistration entityRegistration
private DataFolder dataFolder
ENTITIES_FOLDER inside of this folder.private final List<Collection<?>> entities
public void buildEntities()
throws IOException
DataProviderDataProvider.writeEntities(EntitySqlGenerator).buildEntities in interface DataProviderIOException - if something happens during any possible import of the generated entitiesprotected org.fastnate.generator.context.EntityClass<?> findEntityClass(DataFile importFile)
importFile - the file that is importedprotected abstract Collection<?> importFile(DataFile importFile) throws DataImportException, IOException
importFile - the file that contains the entitiesnull if the file was not importedIOException - if the file was not accessibleDataImportException - if the file content was invalidprotected abstract boolean isImportFile(DataFile file)
file - the file to checktrue if that file needs to be imported by this data providerprivate void readImportFile(DataFile file)
public void writeEntities(org.fastnate.generator.EntitySqlGenerator sqlGenerator)
throws IOException
DataProviderentities to the SQL file using the given generator.writeEntities in interface DataProvidersqlGenerator - the SQL file generatorIOException - if the generator throws oneprotected org.fastnate.generator.context.GeneratorContext getContext()
protected EntityRegistration getEntityRegistration()
Copyright © 2026 fastnate.org. All rights reserved.