Class DefaultAgencyIdFieldMappingFactory
java.lang.Object
org.onebusaway.gtfs.serialization.mappings.DefaultAgencyIdFieldMappingFactory
- All Implemented Interfaces:
FieldMappingFactory
- Direct Known Subclasses:
RouteAgencyIdFieldMappingFactory,TripAgencyIdFieldMappingFactory
A
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 TypeMethodDescriptioncreateFieldMapping(EntitySchemaFactory schemaFactory, Class<?> entityType, String csvFieldName, String objFieldName, Class<?> objFieldType, boolean required)
-
Constructor Details
-
DefaultAgencyIdFieldMappingFactory
public DefaultAgencyIdFieldMappingFactory() -
DefaultAgencyIdFieldMappingFactory
-
-
Method Details
-
createFieldMapping
public FieldMapping createFieldMapping(EntitySchemaFactory schemaFactory, Class<?> entityType, String csvFieldName, String objFieldName, Class<?> objFieldType, boolean required) - Specified by:
createFieldMappingin interfaceFieldMappingFactory
-