本文整理了Java中freemarker.template.Configuration.getIncompatibleImprovements()
方法的一些代码示例,展示了Configuration.getIncompatibleImprovements()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getIncompatibleImprovements()
方法的具体详情如下:
包路径:freemarker.template.Configuration
类名称:Configuration
方法名:getIncompatibleImprovements
暂无
代码示例来源:origin: org.freemarker/freemarker
/**
* @deprecated Use {@link #getIncompatibleImprovements()} instead.
*/
@Deprecated
public int getParsedIncompatibleEnhancements() {
return getIncompatibleImprovements().intValue();
}
代码示例来源:origin: org.freemarker/freemarker
/**
* Returns {@link Configuration#getIncompatibleImprovements()} from the parent {@link Configuration}. This mostly
* just exist to satisfy the {@link ParserConfiguration} interface.
*
* @throws IllegalStateException
* If the parent configuration wasn't yet set.
*/
public Version getIncompatibleImprovements() {
return getNonNullParentConfiguration().getIncompatibleImprovements();
}
代码示例来源:origin: org.freemarker/freemarker
private boolean getDefaultLogTemplateExceptions() {
return getDefaultLogTemplateExceptions(getIncompatibleImprovements());
}
代码示例来源:origin: org.freemarker/freemarker
private ObjectWrapper getDefaultObjectWrapper() {
return getDefaultObjectWrapper(getIncompatibleImprovements());
}
代码示例来源:origin: org.freemarker/freemarker
private TemplateExceptionHandler getDefaultTemplateExceptionHandler() {
return getDefaultTemplateExceptionHandler(getIncompatibleImprovements());
}
代码示例来源:origin: org.freemarker/freemarker
private AttemptExceptionReporter getDefaultAttemptExceptionReporter() {
return getDefaultAttemptExceptionReporter(getIncompatibleImprovements());
}
代码示例来源:origin: org.freemarker/freemarker
boolean isIcI2324OrLater() {
return configuration.getIncompatibleImprovements().intValue() >= _TemplateAPI.VERSION_INT_2_3_24;
}
代码示例来源:origin: org.freemarker/freemarker
private boolean getDefaultWrapUncheckedExceptions() {
return getDefaultWrapUncheckedExceptions(getIncompatibleImprovements());
}
代码示例来源:origin: org.freemarker/freemarker
private boolean isBeforeIcI2322() {
return configuration.getIncompatibleImprovements().intValue() < _TemplateAPI.VERSION_INT_2_3_22;
}
代码示例来源:origin: org.freemarker/freemarker
private TemplateLookupStrategy getDefaultTemplateLookupStrategy() {
return getDefaultTemplateLookupStrategy(getIncompatibleImprovements());
}
代码示例来源:origin: org.freemarker/freemarker
private TemplateNameFormat getDefaultTemplateNameFormat() {
return getDefaultTemplateNameFormat(getIncompatibleImprovements());
}
代码示例来源:origin: org.freemarker/freemarker
/**
* Override this to specify what the default {@link ObjectWrapper} will be when the
* {@code object_wrapper} Servlet init-param wasn't specified. Note that this is called by
* {@link #createConfiguration()}, and so if that was also overidden but improperly then this method might won't be
* ever called. Also note that if you set the {@code object_wrapper} in {@link #createConfiguration()}, then this
* won't be called, since then that has already specified the default.
*
* <p>
* The default implementation calls {@link Configuration#getDefaultObjectWrapper(freemarker.template.Version)}. You
* should also pass in the version paramter when creating an {@link ObjectWrapper} that supports that. You can get
* the version by calling {@link #getConfiguration()} and then {@link Configuration#getIncompatibleImprovements()}.
*
* @since 2.3.22
*/
protected ObjectWrapper createDefaultObjectWrapper() {
return Configuration.getDefaultObjectWrapper(config.getIncompatibleImprovements());
}
代码示例来源:origin: org.freemarker/freemarker
private TemplateLoader getDefaultTemplateLoader() {
return createDefaultTemplateLoader(getIncompatibleImprovements(), getTemplateLoader());
}
代码示例来源:origin: org.freemarker/freemarker
private CacheStorage getDefaultCacheStorage() {
return createDefaultCacheStorage(getIncompatibleImprovements(), getCacheStorage());
}
代码示例来源:origin: org.freemarker/freemarker
static boolean shouldWrapUncheckedException(Throwable e, Environment env) {
if (FlowControlException.class.isInstance(e)) {
return false;
}
if (env.getWrapUncheckedExceptions()) {
return true;
} else if (env.getConfiguration().getIncompatibleImprovements().intValue() >= _TemplateAPI.VERSION_INT_2_3_27) {
// We have to judge if we dare to wrap this exception, or it's too likely that some applications try to
// catch it around the template processing to do something special. For the same reason, we only wrap very
// frequent exceptions.
// We use "==" instead of "instanceof" deliberately; user defined subclasses must not match.
Class<? extends Throwable> c = e.getClass();
return c == NullPointerException.class
|| c == ClassCastException.class
|| c == IndexOutOfBoundsException.class
|| c == InvocationTargetException.class;
} else {
return false;
}
}
代码示例来源:origin: org.freemarker/freemarker
/**
* Removes all auto-includes, then calls {@link #addAutoInclude(String)} for each {@link List} items.
*
* <p>Before {@linkplain Configuration#Configuration(Version) incompatible improvements} 2.3.25 it doesn't filter
* out duplicates from the list if this method was called on a {@link Configuration} instance.
*/
public void setAutoIncludes(List templateNames) {
NullArgumentException.check("templateNames", templateNames);
// "synchronized" is removed from the API as it's not safe to set anything after publishing the Configuration
synchronized (this) {
if (autoIncludes != null) {
autoIncludes.clear();
}
for (Object templateName : templateNames) {
if (!(templateName instanceof String)) {
throw new IllegalArgumentException("List items must be String-s.");
}
addAutoInclude((String) templateName, this instanceof Configuration && ((Configuration) this)
.getIncompatibleImprovements().intValue() < _TemplateAPI.VERSION_INT_2_3_25);
}
}
}
代码示例来源:origin: org.freemarker/freemarker
/**
* Same as {@link #setParentConfiguration(Configuration)}.
*/
@Override
void setParent(Configurable cfg) {
NullArgumentException.check("cfg", cfg);
if (!(cfg instanceof Configuration)) {
throw new IllegalArgumentException("The parent of a TemplateConfiguration can only be a Configuration");
}
if (parentConfigurationSet) {
if (getParent() != cfg) {
throw new IllegalStateException(
"This TemplateConfiguration is already associated with a different Configuration instance.");
}
return;
}
if (((Configuration) cfg).getIncompatibleImprovements().intValue() < _TemplateAPI.VERSION_INT_2_3_22
&& hasAnyConfigurableSet()) {
throw new IllegalStateException(
"This TemplateConfiguration can't be associated to a Configuration that has "
+ "incompatibleImprovements less than 2.3.22, because it changes non-parser settings.");
}
super.setParent(cfg);
parentConfigurationSet = true;
}
代码示例来源:origin: org.freemarker/freemarker
/**
* A prime constructor to which all other constructors should
* delegate directly or indirectly.
*/
private Template(String name, String sourceName, Configuration cfg, ParserConfiguration customParserConfiguration) {
super(toNonNull(cfg));
this.name = name;
this.sourceName = sourceName;
this.templateLanguageVersion = normalizeTemplateLanguageVersion(toNonNull(cfg).getIncompatibleImprovements());
this.parserConfiguration = customParserConfiguration != null ? customParserConfiguration : getConfiguration();
}
代码示例来源:origin: org.freemarker/freemarker
public Environment(Template template, final TemplateHashModel rootDataModel, Writer out) {
super(template);
configuration = template.getConfiguration();
incompatibleImprovementsGE2328 = configuration.getIncompatibleImprovements().intValue() >= _TemplateAPI.VERSION_INT_2_3_28;
this.globalNamespace = new Namespace(null);
this.currentNamespace = mainNamespace = new Namespace(template);
this.out = out;
this.rootDataModel = rootDataModel;
importMacros(template);
}
代码示例来源:origin: org.freemarker/freemarker
/**
* If IcI >= 2.3.21, sets {@link URLTemplateSource#setUseCaches(boolean)} to {@code false} for sources that come
* from a {@link TemplateLoader} where {@link URLConnection} cache usage wasn't set explicitly.
*/
private Object modifyForConfIcI(Object templateSource) {
if (templateSource == null) return null;
if (config.getIncompatibleImprovements().intValue() < _TemplateAPI.VERSION_INT_2_3_21) {
return templateSource;
}
if (templateSource instanceof URLTemplateSource) {
URLTemplateSource urlTemplateSource = (URLTemplateSource) templateSource;
if (urlTemplateSource.getUseCaches() == null) { // It was left unset
urlTemplateSource.setUseCaches(false);
}
} else if (templateSource instanceof MultiSource) {
modifyForConfIcI(((MultiSource) templateSource).getWrappedSource());
}
return templateSource;
}
内容来源于网络,如有侵权,请联系作者删除!