OptInTemplateClassResolver
public interface TemplateClassResolver
Environment
object.Configurable.setNewBuiltinClassResolver(TemplateClassResolver)
Modifier and Type | Field | Description |
---|---|---|
static TemplateClassResolver |
ALLOWS_NOTHING_RESOLVER |
Doesn't allow resolving any classes.
|
static TemplateClassResolver |
SAFER_RESOLVER |
Same as
UNRESTRICTED_RESOLVER , except that it doesn't allow
resolving ObjectConstructor and Execute and freemarker.template.utility.JythonRuntime . |
static TemplateClassResolver |
UNRESTRICTED_RESOLVER |
Simply calls
ClassUtil.forName(String) . |
Modifier and Type | Method | Description |
---|---|---|
java.lang.Class |
resolve(java.lang.String className,
Environment env,
Template template) |
Gets a
Class based on the class name. |
static final TemplateClassResolver UNRESTRICTED_RESOLVER
ClassUtil.forName(String)
.static final TemplateClassResolver SAFER_RESOLVER
UNRESTRICTED_RESOLVER
, except that it doesn't allow
resolving ObjectConstructor
and Execute
and freemarker.template.utility.JythonRuntime
.static final TemplateClassResolver ALLOWS_NOTHING_RESOLVER
java.lang.Class resolve(java.lang.String className, Environment env, Template template) throws TemplateException
Class
based on the class name.className
- the full-qualified class nameenv
- the environment in which the template executestemplate
- the template where the operation that require the
class resolution resides in. This is null
if the
call doesn't come from a template.TemplateException
- if the class can't be found or shouldn't be
accessed from a template for security reasons.