public abstract static class Entity.Loader<E extends Entity> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected GTFSFeed |
feed |
protected Set<String> |
missingRequiredColumns |
protected com.csvreader.CsvReader |
reader |
protected int |
row |
protected String |
tableName |
| Constructor and Description |
|---|
Loader(GTFSFeed feed,
String tableName) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
checkRangeInclusive(double min,
double max,
double actual) |
protected LocalDate |
getDateField(String column,
boolean required)
Fetch the given column of the current row, and interpret it as a date in the format YYYYMMDD.
|
protected double |
getDoubleField(String column,
boolean required,
double min,
double max) |
protected int |
getIntField(String column,
boolean required,
int min,
int max) |
protected int |
getIntField(String column,
boolean required,
int min,
int max,
int defaultValue) |
protected <K,V> V |
getRefField(String column,
boolean required,
Map<K,V> target)
Used to check referential integrity.
|
protected String |
getStringField(String column,
boolean required) |
protected int |
getTimeField(String column,
boolean required)
Fetch the given column of the current row, and interpret it as a time in the format HH:MM:SS.
|
protected URL |
getUrlField(String column,
boolean required)
Fetch the given column of the current row, and interpret it as a URL.
|
protected abstract boolean |
isRequired() |
protected abstract void |
loadOneRow()
Implemented by subclasses to read one row, produce one GTFS entity, and store that entity in a map.
|
void |
loadTable(ZipFile zip)
The main entry point into an Entity.Loader.
|
protected final GTFSFeed feed
protected final String tableName
protected com.csvreader.CsvReader reader
protected int row
protected boolean checkRangeInclusive(double min,
double max,
double actual)
protected String getStringField(String column, boolean required) throws IOException
IOExceptionprotected int getIntField(String column, boolean required, int min, int max) throws IOException
IOExceptionprotected int getIntField(String column, boolean required, int min, int max, int defaultValue) throws IOException
IOExceptionprotected int getTimeField(String column, boolean required) throws IOException
IOExceptionprotected LocalDate getDateField(String column, boolean required) throws IOException
IOExceptionprotected URL getUrlField(String column, boolean required) throws IOException
IOExceptionprotected double getDoubleField(String column, boolean required, double min, double max) throws IOException
IOExceptionprotected <K,V> V getRefField(String column, boolean required, Map<K,V> target) throws IOException
IOExceptionprotected abstract boolean isRequired()
protected abstract void loadOneRow()
throws IOException
IOExceptionpublic void loadTable(ZipFile zip) throws IOException
zip - the zip file from which to read a tableIOExceptionCopyright © 2019. All rights reserved.