本文整理汇总了Java中freemarker.template.DefaultObjectWrapperBuilder.setExposeFields方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultObjectWrapperBuilder.setExposeFields方法的具体用法?Java DefaultObjectWrapperBuilder.setExposeFields怎么用?Java DefaultObjectWrapperBuilder.setExposeFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类freemarker.template.DefaultObjectWrapperBuilder
的用法示例。
在下文中一共展示了DefaultObjectWrapperBuilder.setExposeFields方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFreeMarkerConfiguration
import freemarker.template.DefaultObjectWrapperBuilder; //导入方法依赖的package包/类
/**
* Creates a new FreeMarker configuration.
* By default, it is configured as follows:
* <ul>
* <li>compatibility level is set to 2.3.23
* <li>the object wrapper is configured to expose fields
* <li>API builtins are enabled
* <li>there are 2 template loaders - 1 for loading templates from /META-INF using a classloader and a second
* one to load templates from files.
* </ul>
* @return
*/
protected Configuration createFreeMarkerConfiguration() {
DefaultObjectWrapperBuilder bld = new DefaultObjectWrapperBuilder(Configuration.VERSION_2_3_23);
bld.setExposeFields(true);
Configuration freeMarker = new Configuration(Configuration.VERSION_2_3_23);
freeMarker.setObjectWrapper(bld.build());
freeMarker.setAPIBuiltinEnabled(true);
freeMarker.setTemplateLoader(new MultiTemplateLoader(
new TemplateLoader[]{new ClassTemplateLoader(getClass(), "/META-INF"),
new NaiveFileTemplateLoader()}));
return freeMarker;
}
示例2: Environment
import freemarker.template.DefaultObjectWrapperBuilder; //导入方法依赖的package包/类
private Environment() {
Configuration cfg = new Configuration(Configuration.VERSION_2_3_23);
// Specify the data source where the template files come from.
cfg.setClassForTemplateLoading(getClass(), "/templates/");
DefaultObjectWrapperBuilder builder = new DefaultObjectWrapperBuilder(Configuration.VERSION_2_3_23);
builder.setExposeFields(true);
cfg.setObjectWrapper(builder.build());
freemarkerConfig = cfg;
fmHelper = new FreeMarkerHelper();
templateCache = new ConcurrentHashMap<String, Template>();
symbols = new ConcurrentHashMap<String, String>();
textFormatter = new TextFormatter();
xmlFormatter = new XMLFormatter();
nsContext = new NamespaceContextImpl();
fillNamespaceContext();
xPathHelper = new XPathHelper();
jsonPathHelper = new JsonPathHelper();
jsonHelper = new JsonHelper();
htmlCleaner = new HtmlCleaner();
httpClient = new HttpClient();
programHelper = new ProgramHelper();
programHelper.setTimeoutHelper(timeoutHelper);
configDatesHelper();
driverManager = new DriverManager();
cookieConverter = new CookieConverter();
}