public class DefaultAgencyIdFieldMappingFactory extends Object implements org.onebusaway.csv_entities.schema.FieldMappingFactory
FieldMappingFactory implementation that produces a
FieldMapping that is responsible for setting the
AgencyAndId.setAgencyId(String) portion of an AgencyAndId
identifier.
The GTFS library makes use of AgencyAndId identifier for most ids for
GTFS entities, so as to provide as simple namespace mechanism for loading
multiple feeds from different agencies into the same data-store. Since agency
ids only appear in a few places in a GTFS feed, if at all, we need some
mechanism for setting the agencyId portion of ids for all appropriate
entities in the system.
This FieldMappingFactory and the FieldMapping it produces
does the heavy lifting of setting those agencyId values in an appropriate
way.
By default, we use the agencyId returned by
GtfsReaderContext.getDefaultAgencyId(). However, if you specify a
property path expression to the
DefaultAgencyIdFieldMappingFactory(String) constructor, we will
evaluate that property path expression against the target entity instance to
determine the agencyId. So, for example, to set the agencyId for
Route.getId(), we specify a path of "agency.id", which will call
Route.getAgency() and then Agency.getId() to set the agency
id. See also the path "route.agency.id" for Trip.GtfsEntitySchemaFactory| Constructor and Description |
|---|
DefaultAgencyIdFieldMappingFactory() |
DefaultAgencyIdFieldMappingFactory(String agencyIdPath) |
| Modifier and Type | Method and Description |
|---|---|
org.onebusaway.csv_entities.schema.FieldMapping |
createFieldMapping(org.onebusaway.csv_entities.schema.EntitySchemaFactory schemaFactory,
Class<?> entityType,
String csvFieldName,
String objFieldName,
Class<?> objFieldType,
boolean required) |
public DefaultAgencyIdFieldMappingFactory()
public DefaultAgencyIdFieldMappingFactory(String agencyIdPath)
public org.onebusaway.csv_entities.schema.FieldMapping createFieldMapping(org.onebusaway.csv_entities.schema.EntitySchemaFactory schemaFactory,
Class<?> entityType,
String csvFieldName,
String objFieldName,
Class<?> objFieldType,
boolean required)
createFieldMapping in interface org.onebusaway.csv_entities.schema.FieldMappingFactoryCopyright © 2013 OneBusAway. All Rights Reserved.