Search in sources :

Example 1 with DeferredValueSetter

use of org.onebusaway.gtfs_transformer.deferred.DeferredValueSetter in project onebusaway-gtfs-modules by OneBusAway.

the class TransformFactory method createSetterForValue.

private ValueSetter createSetterForValue(Object value) {
    String stringValue = value.toString();
    Matcher pathMatcher = _pathMatcher.matcher(stringValue);
    if (pathMatcher.matches()) {
        PropertyPathExpression expression = new PropertyPathExpression(pathMatcher.group(1));
        return new PropertyPathExpressionValueSetter(_transformer.getReader(), _schemaCache, _transformer.getDao(), expression);
    }
    Matcher replaceMatcher = _replaceMatcher.matcher(stringValue);
    if (replaceMatcher.matches()) {
        return new ReplaceValueSetter(replaceMatcher.group(1), replaceMatcher.group(2));
    }
    return new DeferredValueSetter(_transformer.getReader(), _schemaCache, _transformer.getDao(), value);
}
Also used : PropertyPathExpressionValueSetter(org.onebusaway.gtfs_transformer.deferred.PropertyPathExpressionValueSetter) Matcher(java.util.regex.Matcher) DeferredValueMatcher(org.onebusaway.gtfs_transformer.deferred.DeferredValueMatcher) ReplaceValueSetter(org.onebusaway.gtfs_transformer.deferred.ReplaceValueSetter) DeferredValueSetter(org.onebusaway.gtfs_transformer.deferred.DeferredValueSetter) PropertyPathExpression(org.onebusaway.collections.beans.PropertyPathExpression)

Aggregations

Matcher (java.util.regex.Matcher)1 PropertyPathExpression (org.onebusaway.collections.beans.PropertyPathExpression)1 DeferredValueMatcher (org.onebusaway.gtfs_transformer.deferred.DeferredValueMatcher)1 DeferredValueSetter (org.onebusaway.gtfs_transformer.deferred.DeferredValueSetter)1 PropertyPathExpressionValueSetter (org.onebusaway.gtfs_transformer.deferred.PropertyPathExpressionValueSetter)1 ReplaceValueSetter (org.onebusaway.gtfs_transformer.deferred.ReplaceValueSetter)1