if (modDef != null) {
try {
modDef.testDependencies();
}
catch (ModuleDependencyException e) {
throw new FormattingException("WebTML encoder '" + encode + "' not available bc. of missing dependency: " + e.getMessage());
}
formatterClass = modDef.getImplementationClass();
}
}
if (formatterClass != null) {
try {
if (modDef != null) {
formatter = (ObjectFormatter) getModuleRegistry().instantiate(modDef);
}
else {
formatter = (ObjectFormatter) formatterClass.newInstance();
}
}
catch (Exception e) {
throw new FormattingException("The encoder class " + formatterClass.getName() + " is not instantiable", e);
}
}
else {
throw new FormattingException("Unknown encoder " + encode);
}
}
if (formatter instanceof TMLContextAwareFormatter) {
((TMLContextAwareFormatter) formatter).setContext(context);