当前位置: 首页>>代码示例>>Java>>正文


Java Configuration.VERSION_2_3_23属性代码示例

本文整理汇总了Java中freemarker.template.Configuration.VERSION_2_3_23属性的典型用法代码示例。如果您正苦于以下问题:Java Configuration.VERSION_2_3_23属性的具体用法?Java Configuration.VERSION_2_3_23怎么用?Java Configuration.VERSION_2_3_23使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在freemarker.template.Configuration的用法示例。


在下文中一共展示了Configuration.VERSION_2_3_23属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildToOutputStream

public void buildToOutputStream(Class<?> commonServiceClass, OutputStream os) throws Exception {
	Configuration cfg = new Configuration(Configuration.VERSION_2_3_23);
	cfg.setClassForTemplateLoading(ThriftFileBuilder.class, "/");
	Template template = cfg.getTemplate("templates/thrift/thrift.ftl");
	Writer out = new OutputStreamWriter(os);

	ThriftServiceBuilder serviceBuilder = new ThriftServiceBuilder(commonServiceClass);
	ThriftService service = serviceBuilder.buildThriftService();

	Map<String, Object> rootMap = new HashMap<String, Object>();
	rootMap.put("thriftServicePackage", this.getPackageName(commonServiceClass));
	List<ThriftStruct> structs = serviceBuilder.getStructs();
	List<ThriftEnum> enums = serviceBuilder.getEnums();
	CommonUtils.removeRepeat(structs);
	rootMap.put("structList", structs);
	rootMap.put("enumList", enums);
	CommonUtils.removeRepeat(enums);
	rootMap.put("serviceList", Arrays.asList(service));

	template.process(rootMap, out);
}
 
开发者ID:funtl,项目名称:framework,代码行数:21,代码来源:ThriftFileBuilder.java

示例2: main

public static void main(String[] args) {
    Map<String,Object> tmp = new HashMap<>();
    tmp.put("user","邢天宇");
    Configuration cfg = new Configuration(Configuration.VERSION_2_3_23);
    StringTemplateLoader loader = new StringTemplateLoader();
    loader.putTemplate(NAME,"hello ${user}");
    cfg.setTemplateLoader(loader);
    cfg.setDefaultEncoding("UTF-8");
    try {
        Template template = cfg.getTemplate(NAME);
        StringWriter writer = new StringWriter();
        template.process(tmp,writer);
        System.out.println(writer.toString());
    } catch (Exception e) {
        e.printStackTrace();
    }

}
 
开发者ID:rpgmakervx,项目名称:slardar,代码行数:18,代码来源:TemplateParser.java

示例3: DaoGenerator

public DaoGenerator() throws IOException {
    System.out.println("greenDAO Generator");
    System.out.println("Copyright 2011-2016 Markus Junginger, greenrobot.de. Licensed under GPL V3.");
    System.out.println("This program comes with ABSOLUTELY NO WARRANTY");

    patternKeepIncludes = compilePattern("INCLUDES");
    patternKeepFields = compilePattern("FIELDS");
    patternKeepMethods = compilePattern("METHODS");

    Configuration config = new Configuration(Configuration.VERSION_2_3_23);
    config.setClassForTemplateLoading(this.getClass(), "/");

    templateDao = config.getTemplate("dao.ftl");
    templateDaoMaster = config.getTemplate("dao-master.ftl");
    templateDaoSession = config.getTemplate("dao-session.ftl");
    templateEntity = config.getTemplate("entity.ftl");
    templateDaoUnitTest = config.getTemplate("dao-unit-test.ftl");
    templateContentProvider = config.getTemplate("content-provider.ftl");
}
 
开发者ID:xsingHu,项目名称:xs-android-architecture,代码行数:19,代码来源:DaoGenerator.java

示例4: initializeConfiguration

/**
 * Configures freemarker for usage.
 * @return
 * @throws URISyntaxException
 * @throws TemplateNotFoundException
 * @throws MalformedTemplateNameException
 * @throws ParseException
 * @throws IOException
 * @throws TemplateException
 */
private Configuration initializeConfiguration() throws URISyntaxException, TemplateNotFoundException, MalformedTemplateNameException, ParseException, IOException, TemplateException{
	Configuration cfg = new Configuration(Configuration.VERSION_2_3_23);
	cfg.setClassForTemplateLoading(DwFeatureModelSVGGenerator.class, "templates");
	cfg.setDefaultEncoding("UTF-8");
	cfg.setLocale(Locale.US);
	cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);

	Bundle bundle = Platform.getBundle("de.darwinspl.feature.graphical.editor");
	URL fileURL = bundle.getEntry("templates/");

	File file = new File(FileLocator.resolve(fileURL).toURI());
	cfg.setDirectoryForTemplateLoading(file);
	
	Map<String, TemplateNumberFormatFactory> customNumberFormats = new HashMap<String, TemplateNumberFormatFactory>();

	customNumberFormats.put("hex", DwHexTemplateNumberFormatFactory.INSTANCE);

	cfg.setCustomNumberFormats(customNumberFormats);

	return cfg;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:31,代码来源:DwFeatureModelSVGGenerator.java

示例5: initializeConfiguration

private Configuration initializeConfiguration() throws URISyntaxException, TemplateNotFoundException, MalformedTemplateNameException, ParseException, IOException, TemplateException{
	Configuration cfg = new Configuration(Configuration.VERSION_2_3_23);
	cfg.setClassForTemplateLoading(DwFeatureModelOverviewGenerator.class, "templates");
	cfg.setDefaultEncoding("UTF-8");
	cfg.setLocale(Locale.US);
	cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
	
	Map<String, TemplateDateFormatFactory> customDateFormats = new HashMap<String, TemplateDateFormatFactory>();
	customDateFormats.put("simple", DwSimpleTemplateDateFormatFactory.INSTANCE);
	
	cfg.setCustomDateFormats(customDateFormats);
	cfg.setDateTimeFormat("@simle");

	Bundle bundle = Platform.getBundle("eu.hyvar.feature.graphical.editor");
	URL fileURL = bundle.getEntry("templates/");

	File file = new File(FileLocator.resolve(fileURL).toURI());
	cfg.setDirectoryForTemplateLoading(file);

	return cfg;
}
 
开发者ID:DarwinSPL,项目名称:DarwinSPL,代码行数:21,代码来源:DwFeatureModelOverviewGenerator.java

示例6: before

public void before() {
	configuration = new Configuration(Configuration.VERSION_2_3_23);
	// configuration.setObjectWrapper(new
	// DefaultObjectWrapper(Configuration.VERSION_2_3_23));
	try {
		// File resource = ResourceUtils.getResourceAsFile("/");
		// logger.debug("path:" + resource.getAbsolutePath());
		StringTemplateLoader templateLoader = new StringTemplateLoader();
		configuration.setTemplateLoader(templateLoader);
		Resource[] resources = ResourceUtils.getResources("classpath*:/template/*.ftl");
		for (Resource resource : resources) {
			String fileName = resource.getFilename();
			String value = IOUtils.toString(resource.getInputStream());
			templateLoader.putTemplate(fileName, value);
		}
		// templateLoader.putTemplate();
		
		// configuration.setDirectoryForTemplateLoading(resource);
	} catch (IOException e) {
		logger.error(e.getMessage(), e);
	}
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:22,代码来源:GeneratorConfig.java

示例7: PluginStatusReportViewBuilder

private PluginStatusReportViewBuilder() throws IOException {
    configuration = new Configuration(Configuration.VERSION_2_3_23);
    configuration.setTemplateLoader(new ClassTemplateLoader(getClass(), "/"));
    configuration.setDefaultEncoding("UTF-8");
    configuration.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
    configuration.setLogTemplateExceptions(false);
    configuration.setDateTimeFormat("iso");
}
 
开发者ID:gocd,项目名称:kubernetes-elastic-agents,代码行数:8,代码来源:PluginStatusReportViewBuilder.java

示例8: renderString

public static String renderString(String templateString, Map<String, ?> model) {
	try {
		StringWriter result = new StringWriter();
		Template t = new Template("name", new StringReader(templateString), new Configuration(Configuration.VERSION_2_3_23));
		t.process(model, result);
		return result.toString();
	} catch (Exception e) {
		throw Exceptions.unchecked(e);
	}
}
 
开发者ID:funtl,项目名称:framework,代码行数:10,代码来源:FreeMarkers.java

示例9: FreemarkerAttachmentRenderer

public FreemarkerAttachmentRenderer(final String templateName) {
    this.templateName = templateName;
    this.configuration = new Configuration(Configuration.VERSION_2_3_23);
    this.configuration.setLocalizedLookup(false);
    this.configuration.setTemplateUpdateDelayMilliseconds(0);
    this.configuration.setClassLoaderForTemplateLoading(getClass().getClassLoader(), "tpl");
}
 
开发者ID:allure-framework,项目名称:allure-java,代码行数:7,代码来源:FreemarkerAttachmentRenderer.java

示例10: IndexServlet

public IndexServlet(DACConfig config, ServerHealthMonitor serverHealthMonitor, OptionManager options, SupportService supportService) {
  this.config = config;
  this.templateCfg = new Configuration(Configuration.VERSION_2_3_23);
  this.serverHealthMonitor = serverHealthMonitor;
  this.options = options;
  this.supportService = supportService;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:7,代码来源:IndexServlet.java

示例11: SpGenerator

public SpGenerator() throws IOException {
    Configuration config = new Configuration(Configuration.VERSION_2_3_23);
    config.setClassForTemplateLoading(this.getClass(), "/");

    mTemplateSp = config.getTemplate("sp.ftl");
    mTemplateMaster = config.getTemplate("master.ftl");

}
 
开发者ID:holmeszyx,项目名称:sp-gen,代码行数:8,代码来源:SpGenerator.java

示例12: createTemplateConfiguration

private static Configuration createTemplateConfiguration() {
	// The templates rendered by this demo application are based on Apache Freemarker.
	
	Configuration cfg = new Configuration(Configuration.VERSION_2_3_23);
	cfg.setClassLoaderForTemplateLoading(TotpExample.class.getClassLoader(), ResourcesHome.class.getPackage().getName().replace(".", "/"));
	cfg.setDefaultEncoding("UTF-8");
	
	// SECURITY NOTE: You should use the TemplateExceptionHandler.RETHROW_HANDLER in production!
	cfg.setTemplateExceptionHandler(TemplateExceptionHandler.HTML_DEBUG_HANDLER);
	return cfg;
}
 
开发者ID:rzwitserloot,项目名称:totp-example,代码行数:11,代码来源:TotpExample.java

示例13: Template

public Template() {
    configuration = new Configuration(Configuration.VERSION_2_3_23);
    // configuration.setObjectWrapper(new
    // DefaultObjectWrapper(Configuration.VERSION_2_3_23));
    templateMapping = new HashMap<String, JavaModeGenerate>();
    templateLoader = new StringTemplateLoader();
    configuration.setTemplateLoader(templateLoader);
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:8,代码来源:Template.java

示例14: before

@Before
    public void before() {
        configuration = new Configuration(Configuration.VERSION_2_3_23);
//        configuration.setObjectWrapper(new DefaultObjectWrapper(Configuration.VERSION_2_3_23));
        try {
            File resource = ResourceUtils.getResourceAsFile("/template");
            logger.debug("path:" + resource.getAbsolutePath());
            configuration.setDirectoryForTemplateLoading(resource);
        } catch (IOException e) {
            logger.error(e.getMessage(), e);
        }
    }
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:12,代码来源:FreemarkerTest.java

示例15: buildConfiguration

public static Configuration buildConfiguration(String directory) throws IOException {
	Configuration cfg = new Configuration(Configuration.VERSION_2_3_23);
	Resource path = new DefaultResourceLoader().getResource(directory);
	cfg.setDirectoryForTemplateLoading(path.getFile());
	return cfg;
}
 
开发者ID:funtl,项目名称:framework,代码行数:6,代码来源:FreeMarkers.java


注:本文中的freemarker.template.Configuration.VERSION_2_3_23属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。