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


Java Engine.transform方法代码示例

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


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

示例1: format

import com.floreysoft.jmte.Engine; //导入方法依赖的package包/类
@Override
public String format(Locale locale) {
	final ResourceBundle messages = ResourceBundle.getBundle(baseName, locale);
	final String frameTemplate = getTemplate(messages, frameCode, "${prefix} ${location}: ${message}");
	final String prefixTemplate = getTemplate(messages, prefixCode, "");
	final String locationTemplate = getTemplate(messages, locationCode, "");
	final String messageTemplate = getTemplate(messages, messageCode, "");
	
	Engine engine = new Engine();
	engine.setErrorHandler(new InternalErrorHandler());
	argumentModel.put("prefix", engine.transform(prefixTemplate, argumentModel));
	argumentModel.put("location", engine.transform(locationTemplate, argumentModel));
	argumentModel.put("message", engine.transform(messageTemplate, argumentModel));
	
	String transformed = engine.transform(frameTemplate, argumentModel);
	return transformed;

}
 
开发者ID:onyxbits,项目名称:Droidentify,代码行数:19,代码来源:ResourceBundleMessage.java

示例2: send

import com.floreysoft.jmte.Engine; //导入方法依赖的package包/类
@Override
public void send(Message message) throws InterruptedException {
    Iterator messageFields = message.getFields().entrySet().iterator();
    Map<String, Object> model = new HashMap<>();
    while (messageFields.hasNext()) {
        Map.Entry pair = (Map.Entry) messageFields.next();
        model.put(String.valueOf(pair.getKey()), String.valueOf(pair.getValue()));
    }
    Engine engine = new Engine();
    String queryString = engine.transform(configuration.getString(Neo4jOutput.CK_NEO4J_QUERY), model);
    List<HashMap<String, String>> query = parseQuery(queryString);

    postQuery(query);
}
 
开发者ID:mariussturm,项目名称:graylog-plugin-output-neo4j,代码行数:15,代码来源:Neo4JHttpTransport.java

示例3: formatPlain

import com.floreysoft.jmte.Engine; //导入方法依赖的package包/类
@Override
public String formatPlain(Locale locale) {
	final ResourceBundle messages = ResourceBundle.getBundle(baseName, locale);
	final String messageTemplate = getTemplate(messages, messageCode, "");
	
	Engine engine = new Engine();
	engine.setErrorHandler(new InternalErrorHandler());
	String transformed = engine.transform(messageTemplate, argumentModel);
	return transformed;
}
 
开发者ID:onyxbits,项目名称:Droidentify,代码行数:11,代码来源:ResourceBundleMessage.java

示例4: transform

import com.floreysoft.jmte.Engine; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static String transform(File template, File propertiesFile,
		String charsetName) throws UnsupportedEncodingException,
		FileNotFoundException, IOException {
	if (!template.exists()) {
		throw new IllegalArgumentException(String.format(
				"Tempalte file '%s' does not exist", template
						.getCanonicalPath()));
	}
	if (!propertiesFile.exists()) {
		throw new IllegalArgumentException(String.format(
				"Properties file '%s' does not exist", propertiesFile
						.getCanonicalPath()));
	}
	FileInputStream stream = null;
	try {
		String input = Util.fileToString(template, charsetName);
		Engine engine = new Engine();

		Properties properties = new Properties();
		stream = new FileInputStream(propertiesFile);
		properties.load(stream);

		Map model = properties;
		String transformed = engine.transform(input, model);
		return transformed;
	} finally {
		try {
			stream.close();
		} catch (IOException e) {
		}
	}
}
 
开发者ID:onyxbits,项目名称:Droidentify,代码行数:34,代码来源:Tool.java


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