// Get the minifiers first
List<Minifier> minifiers = new ArrayList<Minifier>(minifiersTypes.size());
for (ElementHandle.Type minifierType : minifiersTypes) {
try {
Class<? extends Minifier> minifierClass = (Class<? extends Minifier>)Asset.class.getClassLoader().loadClass(minifierType.getName().toString());
Minifier minifier = minifierClass.newInstance();
minifiers.add(minifier);
}
catch (InstantiationException e) {
throw new IOException(e.getMessage(), e.getCause());
}
catch (Exception e) {
throw new IOException(e);
}
}
// Now transform
for (Minifier minifier : minifiers) {
in = minifier.minify(source, type, in);
}
}
}
return in;
}