本文整理汇总了Java中com.samskivert.mustache.Template.Fragment方法的典型用法代码示例。如果您正苦于以下问题:Java Template.Fragment方法的具体用法?Java Template.Fragment怎么用?Java Template.Fragment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.samskivert.mustache.Template
的用法示例。
在下文中一共展示了Template.Fragment方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.samskivert.mustache.Template; //导入方法依赖的package包/类
@Override
public void execute(Template.Fragment frag, Writer out) throws IOException {
String body = frag.execute();
int split = body.indexOf('|');
String expr;
String format;
if (split == -1) {
expr = body.trim();
format = DEFAULT_FORMAT;
} else {
expr = body.substring(0, split).trim();
format = body.substring(split + 1).trim();
}
if(expr.length() == 0) {
log.debug("date_format_lambda param date is empty!");
return;
}
out.write(new SimpleDateFormat(format).format(new Date(Long.parseLong(expr))));
}
示例2: execute
import com.samskivert.mustache.Template; //导入方法依赖的package包/类
@Override
public void execute(Template.Fragment frag, Writer out) throws IOException {
Map<String, Object> map = (Map<String, Object>) frag.context();
map.put("usuario", sessionService.getUsuarioActual());
body = frag.execute();
compiler.compile("{{>nav}}").execute(map, out);
}
示例3: execute
import com.samskivert.mustache.Template; //导入方法依赖的package包/类
@Override
public void execute(Template.Fragment frag, Writer out) throws IOException {
Map<String, Object> map = (Map<String, Object>) frag.context();
if (flashService.getSuccess() != null) {
map.put("success", flashService.getSuccess());
flashService.setSuccess(null);
} else if (flashService.getError() != null) {
map.put("error", flashService.getError());
flashService.setError(null);
}
body = frag.execute();
compiler.compile("{{>flash}}").execute(map, out);
}
示例4: execute
import com.samskivert.mustache.Template; //导入方法依赖的package包/类
@Override
public void execute(Template.Fragment frag, Writer out) throws IOException {
String expr = frag.execute();
int questIndex = expr.indexOf('?');
if (questIndex == -1) {
log.warn("Illegal ternary_lambda expression: {}", expr);
return;
}
String compareExpr = expr.substring(0, questIndex).trim();
int elseIndex = expr.indexOf(':');
String value;
String elseValue;
if (elseIndex == -1) {
value = expr.substring(questIndex + 1);
elseValue = "";
} else {
value = expr.substring(questIndex + 1, elseIndex);
elseValue = expr.substring(elseIndex + 1);
}
int compareIndex = compareExpr.indexOf('=');
String result;
if (compareIndex == -1) {
result = compareExpr.length() == 0 || compareExpr.equals("false") ? elseValue : value;
} else {
result = compareExpr.substring(0, compareIndex).equals(compareExpr.substring(compareIndex + 1)) ? value : elseValue;
}
out.write(result);
}
示例5: execute
import com.samskivert.mustache.Template; //导入方法依赖的package包/类
@Override
public void execute(Template.Fragment frag, Writer out) throws IOException {
String text = frag.execute();
int split = text.indexOf('|');
if (split == -1) {
log.warn("Illegal variable_lambda expression: {}", text);
return;
}
//noinspection unchecked
((Map<String, Object>) frag.context()).put(text.substring(0, split), text.substring(split + 1));
}
示例6: execute
import com.samskivert.mustache.Template; //导入方法依赖的package包/类
@Override
public void execute(Template.Fragment frag, Writer out) throws IOException {
String body = frag.execute();
if (body.equals(((Map) frag.context()).get(NavNameLambda.NAME))) {
out.write(ACTIVE_CLASS_NAME);
}
}
示例7: execute
import com.samskivert.mustache.Template; //导入方法依赖的package包/类
@Override
public void execute(Template.Fragment frag, Writer out) throws IOException {
//noinspection unchecked
Map<String, Object> context = (Map<String, Object>) frag.context();
context.put("__body__", frag.execute());
compiler.compile("{{>" + layoutMapper.getLayout((String) context.get("__template_name__")) + "}}").execute(frag.context(), out);
}
示例8: execute
import com.samskivert.mustache.Template; //导入方法依赖的package包/类
@Override
public void execute(Template.Fragment frag, Writer out) throws IOException {
//noinspection unchecked
((Map<String, Object>) frag.context()).put(getName(), frag.execute());
}
示例9: execute
import com.samskivert.mustache.Template; //导入方法依赖的package包/类
@Override
public void execute(Template.Fragment frag, Writer out) throws IOException {
out.write(formatUrl(frag.execute()));
}
示例10: execute
import com.samskivert.mustache.Template; //导入方法依赖的package包/类
@Override
public void execute(Template.Fragment frag, Writer out) throws IOException {
if (!dev) {
frag.execute(out);
}
}