Search in sources :

Example 1 with GtfsTransformStrategyFactory

use of org.onebusaway.gtfs_transformer.services.GtfsTransformStrategyFactory in project onebusaway-gtfs-modules by OneBusAway.

the class TransformFactory method handleTransformOperation.

private void handleTransformOperation(String line, JSONObject json, Object factoryObj) throws JSONException, TransformSpecificationException {
    setObjectPropertiesFromJsonUsingCsvFields(factoryObj, json, line);
    boolean added = false;
    if (factoryObj instanceof GtfsTransformStrategy) {
        _transformer.addTransform((GtfsTransformStrategy) factoryObj);
        added = true;
    }
    if (factoryObj instanceof GtfsEntityTransformStrategy) {
        _transformer.addEntityTransform((GtfsEntityTransformStrategy) factoryObj);
        added = true;
    }
    if (factoryObj instanceof GtfsTransformStrategyFactory) {
        GtfsTransformStrategyFactory factory = (GtfsTransformStrategyFactory) factoryObj;
        factory.createTransforms(_transformer);
        added = true;
    }
    if (!added) {
        throw new TransformSpecificationException("factory object is not an instance of GtfsTransformStrategy, GtfsEntityTransformStrategy, or GtfsTransformStrategyFactory: " + factoryObj.getClass().getName(), line);
    }
}
Also used : GtfsTransformStrategyFactory(org.onebusaway.gtfs_transformer.services.GtfsTransformStrategyFactory) GtfsEntityTransformStrategy(org.onebusaway.gtfs_transformer.services.GtfsEntityTransformStrategy) GtfsTransformStrategy(org.onebusaway.gtfs_transformer.services.GtfsTransformStrategy) TransformSpecificationException(org.onebusaway.gtfs_transformer.TransformSpecificationException)

Aggregations

TransformSpecificationException (org.onebusaway.gtfs_transformer.TransformSpecificationException)1 GtfsEntityTransformStrategy (org.onebusaway.gtfs_transformer.services.GtfsEntityTransformStrategy)1 GtfsTransformStrategy (org.onebusaway.gtfs_transformer.services.GtfsTransformStrategy)1 GtfsTransformStrategyFactory (org.onebusaway.gtfs_transformer.services.GtfsTransformStrategyFactory)1