本文整理了Java中freemarker.template.Configuration.recreateTemplateCacheWith()
方法的一些代码示例,展示了Configuration.recreateTemplateCacheWith()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.recreateTemplateCacheWith()
方法的具体详情如下:
包路径:freemarker.template.Configuration
类名称:Configuration
方法名:recreateTemplateCacheWith
暂无
代码示例来源:origin: org.freemarker/freemarker
@Override
public Object clone() {
try {
Configuration copy = (Configuration) super.clone();
copy.sharedVariables = new HashMap(sharedVariables);
copy.localeToCharsetMap = new ConcurrentHashMap(localeToCharsetMap);
copy.recreateTemplateCacheWith(
cache.getTemplateLoader(), cache.getCacheStorage(),
cache.getTemplateLookupStrategy(), cache.getTemplateNameFormat(),
cache.getTemplateConfigurations());
return copy;
} catch (CloneNotSupportedException e) {
throw new BugException("Cloning failed", e);
}
}
代码示例来源:origin: org.freemarker/freemarker
private void recreateTemplateCache() {
recreateTemplateCacheWith(cache.getTemplateLoader(), cache.getCacheStorage(),
cache.getTemplateLookupStrategy(), cache.getTemplateNameFormat(),
getTemplateConfigurations());
}
代码示例来源:origin: org.freemarker/freemarker
/**
* Sets the template name format used. The default is {@link TemplateNameFormat#DEFAULT_2_3_0}, while the
* recommended value for new projects is {@link TemplateNameFormat#DEFAULT_2_4_0}.
*
* @since 2.3.22
*/
public void setTemplateNameFormat(TemplateNameFormat templateNameFormat) {
if (cache.getTemplateNameFormat() != templateNameFormat) {
recreateTemplateCacheWith(cache.getTemplateLoader(), cache.getCacheStorage(),
cache.getTemplateLookupStrategy(), templateNameFormat,
cache.getTemplateConfigurations());
}
templateNameFormatExplicitlySet = true;
}
代码示例来源:origin: org.freemarker/freemarker
/**
* Sets the {@link TemplateLookupStrategy} that is used to look up templates based on the requested name; as a side
* effect the template cache will be emptied. The default value is {@link TemplateLookupStrategy#DEFAULT_2_3_0}.
*
* @since 2.3.22
*/
public void setTemplateLookupStrategy(TemplateLookupStrategy templateLookupStrategy) {
if (cache.getTemplateLookupStrategy() != templateLookupStrategy) {
recreateTemplateCacheWith(cache.getTemplateLoader(), cache.getCacheStorage(),
templateLookupStrategy, cache.getTemplateNameFormat(),
cache.getTemplateConfigurations());
}
templateLookupStrategyExplicitlySet = true;
}
代码示例来源:origin: org.freemarker/freemarker
/**
* Sets the {@link CacheStorage} used for caching {@link Template}-s;
* the earlier content of the template cache will be dropt.
*
* The default is a {@link SoftCacheStorage}. If the total size of the {@link Template}
* objects is significant but most templates are used rarely, using a
* {@link MruCacheStorage} instead might be advisable. If you don't want caching at
* all, use {@link freemarker.cache.NullCacheStorage} (you can't use {@code null}).
*
* <p>Note that setting the cache storage will re-create the template cache, so
* all its content will be lost.
*/
public void setCacheStorage(CacheStorage cacheStorage) {
// "synchronized" is removed from the API as it's not safe to set anything after publishing the Configuration
synchronized (this) {
if (getCacheStorage() != cacheStorage) {
recreateTemplateCacheWith(cache.getTemplateLoader(), cacheStorage,
cache.getTemplateLookupStrategy(), cache.getTemplateNameFormat(),
cache.getTemplateConfigurations());
}
cacheStorageExplicitlySet = true;
}
}
代码示例来源:origin: org.freemarker/freemarker
recreateTemplateCacheWith(templateLoader, cache.getCacheStorage(),
cache.getTemplateLookupStrategy(), cache.getTemplateNameFormat(),
cache.getTemplateConfigurations());
代码示例来源:origin: org.freemarker/freemarker
/**
* Sets a {@link TemplateConfigurationFactory} that will configure individual templates where their settings differ
* from those coming from the common {@link Configuration} object. A typical use case for that is specifying the
* {@link TemplateConfiguration#setOutputFormat(OutputFormat) outputFormat} for templates based on their file
* extension or parent directory.
*
* <p>
* Note that the settings suggested by standard file extensions are stronger than that you set here. See
* {@link #setRecognizeStandardFileExtensions(boolean)} for more information about standard file extensions.
*
* <p>See "Template configurations" in the FreeMarker Manual for examples.
*
* @since 2.3.24
*/
public void setTemplateConfigurations(TemplateConfigurationFactory templateConfigurations) {
if (cache.getTemplateConfigurations() != templateConfigurations) {
if (templateConfigurations != null) {
templateConfigurations.setConfiguration(this);
}
recreateTemplateCacheWith(cache.getTemplateLoader(), cache.getCacheStorage(),
cache.getTemplateLookupStrategy(), cache.getTemplateNameFormat(),
templateConfigurations);
}
}
代码示例来源:origin: org.freemarker/freemarker-gae
@Override
public Object clone() {
try {
Configuration copy = (Configuration) super.clone();
copy.sharedVariables = new HashMap(sharedVariables);
copy.localeToCharsetMap = new ConcurrentHashMap(localeToCharsetMap);
copy.recreateTemplateCacheWith(
cache.getTemplateLoader(), cache.getCacheStorage(),
cache.getTemplateLookupStrategy(), cache.getTemplateNameFormat(),
cache.getTemplateConfigurations());
return copy;
} catch (CloneNotSupportedException e) {
throw new BugException("Cloning failed", e);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
@Override
public Object clone() {
try {
Configuration copy = (Configuration) super.clone();
copy.sharedVariables = new HashMap(sharedVariables);
copy.localeToCharsetMap = new ConcurrentHashMap(localeToCharsetMap);
copy.recreateTemplateCacheWith(
cache.getTemplateLoader(), cache.getCacheStorage(),
cache.getTemplateLookupStrategy(), cache.getTemplateNameFormat(),
cache.getTemplateConfigurations());
return copy;
} catch (CloneNotSupportedException e) {
throw new BugException("Cloning failed", e);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
private void recreateTemplateCache() {
recreateTemplateCacheWith(cache.getTemplateLoader(), cache.getCacheStorage(),
cache.getTemplateLookupStrategy(), cache.getTemplateNameFormat(),
getTemplateConfigurations());
}
代码示例来源:origin: org.freemarker/freemarker-gae
private void recreateTemplateCache() {
recreateTemplateCacheWith(cache.getTemplateLoader(), cache.getCacheStorage(),
cache.getTemplateLookupStrategy(), cache.getTemplateNameFormat(),
getTemplateConfigurations());
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
/**
* Sets the {@link TemplateLookupStrategy} that is used to look up templates based on the requested name; as a side
* effect the template cache will be emptied. The default value is {@link TemplateLookupStrategy#DEFAULT_2_3_0}.
*
* @since 2.3.22
*/
public void setTemplateLookupStrategy(TemplateLookupStrategy templateLookupStrategy) {
if (cache.getTemplateLookupStrategy() != templateLookupStrategy) {
recreateTemplateCacheWith(cache.getTemplateLoader(), cache.getCacheStorage(),
templateLookupStrategy, cache.getTemplateNameFormat(),
cache.getTemplateConfigurations());
}
templateLookupStrategyExplicitlySet = true;
}
代码示例来源:origin: org.freemarker/freemarker-gae
/**
* Sets the {@link TemplateLookupStrategy} that is used to look up templates based on the requested name; as a side
* effect the template cache will be emptied. The default value is {@link TemplateLookupStrategy#DEFAULT_2_3_0}.
*
* @since 2.3.22
*/
public void setTemplateLookupStrategy(TemplateLookupStrategy templateLookupStrategy) {
if (cache.getTemplateLookupStrategy() != templateLookupStrategy) {
recreateTemplateCacheWith(cache.getTemplateLoader(), cache.getCacheStorage(),
templateLookupStrategy, cache.getTemplateNameFormat(),
cache.getTemplateConfigurations());
}
templateLookupStrategyExplicitlySet = true;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
/**
* Sets the template name format used. The default is {@link TemplateNameFormat#DEFAULT_2_3_0}, while the
* recommended value for new projects is {@link TemplateNameFormat#DEFAULT_2_4_0}.
*
* @since 2.3.22
*/
public void setTemplateNameFormat(TemplateNameFormat templateNameFormat) {
if (cache.getTemplateNameFormat() != templateNameFormat) {
recreateTemplateCacheWith(cache.getTemplateLoader(), cache.getCacheStorage(),
cache.getTemplateLookupStrategy(), templateNameFormat,
cache.getTemplateConfigurations());
}
templateNameFormatExplicitlySet = true;
}
代码示例来源:origin: org.freemarker/freemarker-gae
/**
* Sets the template name format used. The default is {@link TemplateNameFormat#DEFAULT_2_3_0}, while the
* recommended value for new projects is {@link TemplateNameFormat#DEFAULT_2_4_0}.
*
* @since 2.3.22
*/
public void setTemplateNameFormat(TemplateNameFormat templateNameFormat) {
if (cache.getTemplateNameFormat() != templateNameFormat) {
recreateTemplateCacheWith(cache.getTemplateLoader(), cache.getCacheStorage(),
cache.getTemplateLookupStrategy(), templateNameFormat,
cache.getTemplateConfigurations());
}
templateNameFormatExplicitlySet = true;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
/**
* Sets the {@link CacheStorage} used for caching {@link Template}-s;
* the earlier content of the template cache will be dropt.
*
* The default is a {@link SoftCacheStorage}. If the total size of the {@link Template}
* objects is significant but most templates are used rarely, using a
* {@link MruCacheStorage} instead might be advisable. If you don't want caching at
* all, use {@link freemarker.cache.NullCacheStorage} (you can't use {@code null}).
*
* <p>Note that setting the cache storage will re-create the template cache, so
* all its content will be lost.
*/
public void setCacheStorage(CacheStorage cacheStorage) {
// "synchronized" is removed from the API as it's not safe to set anything after publishing the Configuration
synchronized (this) {
if (getCacheStorage() != cacheStorage) {
recreateTemplateCacheWith(cache.getTemplateLoader(), cacheStorage,
cache.getTemplateLookupStrategy(), cache.getTemplateNameFormat(),
cache.getTemplateConfigurations());
}
cacheStorageExplicitlySet = true;
}
}
代码示例来源:origin: org.freemarker/freemarker-gae
/**
* Sets the {@link CacheStorage} used for caching {@link Template}-s;
* the earlier content of the template cache will be dropt.
*
* The default is a {@link SoftCacheStorage}. If the total size of the {@link Template}
* objects is significant but most templates are used rarely, using a
* {@link MruCacheStorage} instead might be advisable. If you don't want caching at
* all, use {@link freemarker.cache.NullCacheStorage} (you can't use {@code null}).
*
* <p>Note that setting the cache storage will re-create the template cache, so
* all its content will be lost.
*/
public void setCacheStorage(CacheStorage cacheStorage) {
// "synchronized" is removed from the API as it's not safe to set anything after publishing the Configuration
synchronized (this) {
if (getCacheStorage() != cacheStorage) {
recreateTemplateCacheWith(cache.getTemplateLoader(), cacheStorage,
cache.getTemplateLookupStrategy(), cache.getTemplateNameFormat(),
cache.getTemplateConfigurations());
}
cacheStorageExplicitlySet = true;
}
}
代码示例来源:origin: org.freemarker/freemarker-gae
recreateTemplateCacheWith(templateLoader, cache.getCacheStorage(),
cache.getTemplateLookupStrategy(), cache.getTemplateNameFormat(),
cache.getTemplateConfigurations());
代码示例来源:origin: org.freemarker/freemarker-gae
/**
* Sets a {@link TemplateConfigurationFactory} that will configure individual templates where their settings differ
* from those coming from the common {@link Configuration} object. A typical use case for that is specifying the
* {@link TemplateConfiguration#setOutputFormat(OutputFormat) outputFormat} for templates based on their file
* extension or parent directory.
*
* <p>
* Note that the settings suggested by standard file extensions are stronger than that you set here. See
* {@link #setRecognizeStandardFileExtensions(boolean)} for more information about standard file extensions.
*
* <p>See "Template configurations" in the FreeMarker Manual for examples.
*
* @since 2.3.24
*/
public void setTemplateConfigurations(TemplateConfigurationFactory templateConfigurations) {
if (cache.getTemplateConfigurations() != templateConfigurations) {
if (templateConfigurations != null) {
templateConfigurations.setConfiguration(this);
}
recreateTemplateCacheWith(cache.getTemplateLoader(), cache.getCacheStorage(),
cache.getTemplateLookupStrategy(), cache.getTemplateNameFormat(),
templateConfigurations);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
/**
* Sets a {@link TemplateConfigurationFactory} that will configure individual templates where their settings differ
* from those coming from the common {@link Configuration} object. A typical use case for that is specifying the
* {@link TemplateConfiguration#setOutputFormat(OutputFormat) outputFormat} for templates based on their file
* extension or parent directory.
*
* <p>
* Note that the settings suggested by standard file extensions are stronger than that you set here. See
* {@link #setRecognizeStandardFileExtensions(boolean)} for more information about standard file extensions.
*
* <p>See "Template configurations" in the FreeMarker Manual for examples.
*
* @since 2.3.24
*/
public void setTemplateConfigurations(TemplateConfigurationFactory templateConfigurations) {
if (cache.getTemplateConfigurations() != templateConfigurations) {
if (templateConfigurations != null) {
templateConfigurations.setConfiguration(this);
}
recreateTemplateCacheWith(cache.getTemplateLoader(), cache.getCacheStorage(),
cache.getTemplateLookupStrategy(), cache.getTemplateNameFormat(),
templateConfigurations);
}
}
内容来源于网络,如有侵权,请联系作者删除!