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 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 EntityClass<?> |
findEntityClass(DataFile importFile)
Tries to guess the class of the imported entities from the file or directory name.
|
protected 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(EntitySqlGenerator sqlGenerator)
Adds all
entities to the SQL file using the given generator. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getOrder
@Generated(value="lombok") private static final org.slf4j.Logger log
private static final String ENTITIES_FOLDER
dataFolder
that contains the entity files.private GeneratorContext context
private EntityRegistration entityRegistration
private DataFolder dataFolder
ENTITIES_FOLDER
inside of this folder.private final List<Collection<?>> entities
public void buildEntities() throws IOException
DataProvider
DataProvider.writeEntities(EntitySqlGenerator)
.buildEntities
in interface DataProvider
IOException
- if something happens during any possible import of the generated entitiesprotected 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(EntitySqlGenerator sqlGenerator) throws IOException
DataProvider
entities
to the SQL file using the given generator.writeEntities
in interface DataProvider
sqlGenerator
- the SQL file generatorIOException
- if the generator throws one@Generated(value="lombok") protected GeneratorContext getContext()
@Generated(value="lombok") protected EntityRegistration getEntityRegistration()
Copyright © 2022 fastnate.org. All rights reserved.