mustache 的 Java 实现 JMustache

码农软件 · 软件分类 · 模板引擎 · 2019-08-22 19:43:09

软件介绍

jmustache 是 Mustache 模板引擎的java实现。

使用方法:

String text = "One, two, {{three}}. Three sir!";
Template tmpl = Mustache.compiler().compile(text);
Map<String, String> data = new HashMap<String, String>();
data.put("three", "five");
System.out.println(tmpl.execute(data));
// result: "One, two, five. Three sir!"

示例2:

class Person {
    public final String name;
    public Person (String name, int age) {
        this.name = name;
        _age = age;
    }
    public int getAge () {
        return _age;
    }
    protected int _age;
}

String tmpl = "{{#persons}}{{name}}: {{age}}{{/persons}}\n";
Mustache.compiler().compile(tmpl).execute(new Object() {
    Object persons = Arrays.asList(new Person("Elvis", 75), new Person("Madonna", 52));
});

// result:
// Elvis: 75
// Madonna: 52

本文地址:https://www.codercto.com/soft/d/12947.html

参与感

参与感

黎万强 / 中信出版社 / 2014-8 / 56.00元

◆雷军亲笔作序,小米联合创始人黎万强著。 ◆揭开小米4年600亿奇迹背后的理念、方法和案例。 ◆了解小米,必读本书! ◆迄今为止关于小米最权威、最透彻、最全面的著作! ◆新一代营销圣经。 ◆2014年最重磅图书! ◆再掀企业界全民学习小米热潮! ◆引爆出版界、财经界、IT界、科技界大震荡的“现象级热书”! ◆全书四色印刷,包含46张海报级插图。 ......一起来看看 《参与感》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具