當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。