public ConstructorFunction(String classname, Environment env) throws TemplateException {
this.env = env;
try {
cl = ClassUtil.forName(classname);
if (!TM_CLASS.isAssignableFrom(cl)) {
throw new TemplateException("Class " + cl.getName() + " does not implement freemarker.template.TemplateModel", env);
}
if (BEAN_MODEL_CLASS.isAssignableFrom(cl)) {
throw new TemplateException("Bean Models cannot be instantiated using the ?new built-in", env);
}
if (JYTHON_MODEL_CLASS != null && JYTHON_MODEL_CLASS.isAssignableFrom(cl)) {
throw new TemplateException("Jython Models cannot be instantiated using the ?new built-in", env);
}
}
catch (ClassNotFoundException cnfe) {
throw new TemplateException(cnfe, env);
}
}