private IDataSet decorateDataSetIfNeeded(IDataSet dataSet, Class<? extends DataSetDecorator>[] decorators) {
if (decorators == null || decorators.length == 0)
return dataSet;
ReplacementDataSet decoratedSet = new ReplacementDataSet(dataSet);
for (Class<? extends DataSetDecorator> decoratorClass : decorators) {
try {
DataSetDecorator decorator = decoratorClass.newInstance();
decoratedSet.addReplacementSubstring(decorator.getStringToReplace(), decorator.getStringReplacement());
} catch (InstantiationException e) {
LOGGER.error("Could not instantiate DataSetDecorator {}" + decoratorClass, e);
} catch (IllegalAccessException e) {
LOGGER.error("Could not instantiate DataSetDecorator {}" + decoratorClass, e);
}