String jsonFactoryClassName = getConfigs().getString(config, "jsonFactory", null);
if (jsonFactoryClassName != null) {
try {
jsonFactory = (JsonFactory) Class.forName(jsonFactoryClassName).newInstance();
} catch (Exception e) {
throw new MorphlineCompilationException("Cannot create instance", config, e);
}
}
String objectMapperClassName = getConfigs().getString(config, "objectMapper", null);
ObjectMapper objectMapper = null;
if (objectMapperClassName != null) {
try {
objectMapper = (ObjectMapper) Class.forName(objectMapperClassName).newInstance();
} catch (Exception e) {
throw new MorphlineCompilationException("Cannot create instance", config, e);
}
} else {
objectMapper = new ObjectMapper(jsonFactory);
}
String outputClassName = getConfigs().getString(config, "outputClass", JsonNode.class.getName());
Class outputClass;
try {
outputClass = Class.forName(outputClassName);
} catch (ClassNotFoundException e) {
throw new MorphlineCompilationException("Class not found", config, e);
}
reader = objectMapper.reader(outputClass);
validateArguments();
}