for (Map.Entry<ContentType, Class<? extends RepresentationWriter>> entry : contentRenderers.entrySet()) {
if (entry.getKey().matches(contentType)) {
try {
return entry.getValue().newInstance();
} catch (InstantiationException e) {
throw new RepresentationException(e);
} catch (IllegalAccessException e) {
throw new RepresentationException(e);
}
}
}
throw new IllegalArgumentException("Unsupported contentType: " + contentType);