Class DefaultAgencyIdFieldMappingFactory
- All Implemented Interfaces:
org.onebusaway.csv_entities.schema.FieldMappingFactory
- Direct Known Subclasses:
RouteAgencyIdFieldMappingFactory,TripAgencyIdFieldMappingFactory
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.
- Author:
- bdferris
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.onebusaway.csv_entities.schema.FieldMappingcreateFieldMapping(org.onebusaway.csv_entities.schema.EntitySchemaFactory schemaFactory, Class<?> entityType, String csvFieldName, String objFieldName, Class<?> objFieldType, boolean required)
-
Constructor Details
-
DefaultAgencyIdFieldMappingFactory
public DefaultAgencyIdFieldMappingFactory() -
DefaultAgencyIdFieldMappingFactory
-
-
Method Details
-
createFieldMapping
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) - Specified by:
createFieldMappingin interfaceorg.onebusaway.csv_entities.schema.FieldMappingFactory
-