freemarker.template.Configuration.setBooleanFormat()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(211)

本文整理了Java中freemarker.template.Configuration.setBooleanFormat()方法的一些代码示例,展示了Configuration.setBooleanFormat()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.setBooleanFormat()方法的具体详情如下:
包路径:freemarker.template.Configuration
类名称:Configuration
方法名:setBooleanFormat

Configuration.setBooleanFormat介绍

暂无

代码示例

代码示例来源:origin: sanluan/PublicCMS

private static void copyConfig(Configuration source, Configuration target) {
  target.setNewBuiltinClassResolver(source.getNewBuiltinClassResolver());
  target.setTemplateUpdateDelayMilliseconds(source.getTemplateUpdateDelayMilliseconds());
  target.setDefaultEncoding(source.getDefaultEncoding());
  target.setLocale(source.getLocale());
  target.setBooleanFormat(source.getBooleanFormat());
  target.setDateTimeFormat(source.getDateTimeFormat());
  target.setDateFormat(source.getDateFormat());
  target.setTimeFormat(source.getTimeFormat());
  target.setNumberFormat(source.getNumberFormat());
  target.setOutputFormat(source.getOutputFormat());
  target.setURLEscapingCharset(source.getURLEscapingCharset());
  target.setLazyAutoImports(source.getLazyAutoImports());
  target.setTemplateExceptionHandler(source.getTemplateExceptionHandler());
}

代码示例来源:origin: sanluan/PublicCMS

private static void copyConfig(Configuration source, Configuration target) {
  target.setNewBuiltinClassResolver(source.getNewBuiltinClassResolver());
  target.setTemplateUpdateDelayMilliseconds(source.getTemplateUpdateDelayMilliseconds());
  target.setDefaultEncoding(source.getDefaultEncoding());
  target.setLocale(source.getLocale());
  target.setBooleanFormat(source.getBooleanFormat());
  target.setDateTimeFormat(source.getDateTimeFormat());
  target.setDateFormat(source.getDateFormat());
  target.setTimeFormat(source.getTimeFormat());
  target.setNumberFormat(source.getNumberFormat());
  target.setOutputFormat(source.getOutputFormat());
  target.setURLEscapingCharset(source.getURLEscapingCharset());
  target.setLazyAutoImports(source.getLazyAutoImports());
  target.setTemplateExceptionHandler(source.getTemplateExceptionHandler());
}

代码示例来源:origin: net.sourceforge.fmpp/fmpp

/**
 * Sets the boolean format used to convert boolean to strings, as defined
 * by {@link Configuration#setBooleanFormat(String)}. Note that it can't be {@code "true,false"}; for that you have
 * to print the boolean value with <code>${foo?c}</code>. 
 */
public void setBooleanFormat(String format) {
  checkParameterLock();
  fmCfg.setBooleanFormat(format);
}

代码示例来源:origin: badqiu/rapid-framework

public static Configuration newDefaultConfirutaion() {
  Configuration conf = new Configuration();
  conf.setNumberFormat("###############");
  conf.setBooleanFormat("true,false");
  
  return conf;
}

代码示例来源:origin: com.sgota.tools/tkcg-core

/**
 * 构造方法.
 */
private TemplateHelper(){
  configuration = new Configuration(new Version(2, 3, 0));
  configuration.setNumberFormat("###############");
  configuration.setBooleanFormat("true,false");
  configuration.setDefaultEncoding("UTF-8");
}

代码示例来源:origin: yuchenggroup/rapid-generator

public static Configuration newFreeMarkerConfiguration(List<File> templateRootDirs,String defaultEncoding,String templateName) throws IOException {
      Configuration conf = new Configuration();
      
      FileTemplateLoader[] templateLoaders = new FileTemplateLoader[templateRootDirs.size()];
      for(int i = 0; i < templateRootDirs.size(); i++) {
        templateLoaders[i] = new FileTemplateLoader((File)templateRootDirs.get(i));
      }
      MultiTemplateLoader multiTemplateLoader = new MultiTemplateLoader(templateLoaders);
      
      conf.setTemplateLoader(multiTemplateLoader);
      conf.setNumberFormat("###############");
      conf.setBooleanFormat("true,false");
      conf.setDefaultEncoding(defaultEncoding);
      
//            String autoIncludes = new File(new File(templateName).getParent(),"macro.include").getPath();
//            List<String> availableAutoInclude = FreemarkerHelper.getAvailableAutoInclude(conf, Arrays.asList("macro.include",autoIncludes));
//            conf.setAutoIncludes(availableAutoInclude);
//            GLogger.info("[set Freemarker.autoIncludes]"+availableAutoInclude+" for templateName:"+templateName);
      
      List<String> autoIncludes = getParentPaths(templateName,"macro.include");
      List<String> availableAutoInclude = FreemarkerHelper.getAvailableAutoInclude(conf,autoIncludes);
      conf.setAutoIncludes(availableAutoInclude);
      GLogger.debug("set Freemarker.autoIncludes:"+availableAutoInclude+" for templateName:"+templateName+" autoIncludes:"+autoIncludes);
      return conf;
    }

代码示例来源:origin: nutzam/nutzboot

protected void initp(Configuration configuration,
           ServletContext sc,
           String prefix,
           String suffix,
           FreemarkerDirectiveFactory freemarkerDirectiveFactory) {
  this.configuration = configuration;
  URL url = ClassTools.getClassLoader().getResource(prefix);
  String path = url.getPath();
  this.prefix = path;
  this.suffix = suffix;
  this.freemarkerDirectiveFactory = freemarkerDirectiveFactory;
  if (this.prefix == null)
    this.prefix = sc.getRealPath("/") + prefix;
  this.configuration.setTagSyntax(Configuration.AUTO_DETECT_TAG_SYNTAX);
  this.configuration.setTemplateUpdateDelayMilliseconds(-1000);
  this.configuration.setDefaultEncoding("UTF-8");
  this.configuration.setURLEscapingCharset("UTF-8");
  this.configuration.setLocale(Locale.CHINA);
  this.configuration.setBooleanFormat("true,false");
  this.configuration.setDateTimeFormat("yyyy-MM-dd HH:mm:ss");
  this.configuration.setDateFormat("yyyy-MM-dd");
  this.configuration.setTimeFormat("HH:mm:ss");
  this.configuration.setNumberFormat("0.######");
  this.configuration.setWhitespaceStripping(true);
}

相关文章

Configuration类方法