Class DefaultAgencyIdFieldMappingFactory
- java.lang.Object
-
- org.onebusaway.gtfs.serialization.mappings.DefaultAgencyIdFieldMappingFactory
-
- All Implemented Interfaces:
org.onebusaway.csv_entities.schema.FieldMappingFactory
- Direct Known Subclasses:
RouteAgencyIdFieldMappingFactory,TripAgencyIdFieldMappingFactory
public class DefaultAgencyIdFieldMappingFactory extends Object implements org.onebusaway.csv_entities.schema.FieldMappingFactory
AFieldMappingFactoryimplementation that produces aFieldMappingthat is responsible for setting theAgencyAndId.setAgencyId(String)portion of anAgencyAndIdidentifier. The GTFS library makes use ofAgencyAndIdidentifier 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. ThisFieldMappingFactoryand theFieldMappingit produces does the heavy lifting of setting those agencyId values in an appropriate way. By default, we use the agencyId returned byGtfsReaderContext.getDefaultAgencyId(). However, if you specify a property path expression to theDefaultAgencyIdFieldMappingFactory(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 forRoute.getId(), we specify a path of "agency.id", which will callRoute.getAgency()and thenAgency.getId()to set the agency id. See also the path "route.agency.id" forTrip.- Author:
- bdferris
- See Also:
GtfsEntitySchemaFactory
-
-
Constructor Summary
Constructors Constructor Description DefaultAgencyIdFieldMappingFactory()DefaultAgencyIdFieldMappingFactory(String agencyIdPath)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.onebusaway.csv_entities.schema.FieldMappingcreateFieldMapping(org.onebusaway.csv_entities.schema.EntitySchemaFactory schemaFactory, Class<?> entityType, String csvFieldName, String objFieldName, Class<?> objFieldType, boolean required)
-
-
-
Constructor Detail
-
DefaultAgencyIdFieldMappingFactory
public DefaultAgencyIdFieldMappingFactory()
-
DefaultAgencyIdFieldMappingFactory
public DefaultAgencyIdFieldMappingFactory(String agencyIdPath)
-
-
Method Detail
-
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
-
-