本文整理汇总了Java中com.github.jknack.handlebars.Options.fn方法的典型用法代码示例。如果您正苦于以下问题:Java Options.fn方法的具体用法?Java Options.fn怎么用?Java Options.fn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.github.jknack.handlebars.Options
的用法示例。
在下文中一共展示了Options.fn方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import com.github.jknack.handlebars.Options; //导入方法依赖的package包/类
@Override
public CharSequence apply(Collection<UpstreamInfo> upstreams, Options options) throws IOException {
if (!currentRackId.isPresent()) {
return options.fn();
}
if (upstreams == null) {
return options.inverse();
}
for (UpstreamInfo upstreamInfo : upstreams) {
if (upstreamInfo.getRackId().isPresent() && upstreamInfo.getRackId().get().toLowerCase().equals(currentRackId.get().toLowerCase())) {
return options.fn();
}
}
return options.inverse();
}
示例2: apply
import com.github.jknack.handlebars.Options; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public CharSequence apply(Object context, Options options) throws IOException {
if (context instanceof Optional) {
context = ((Optional<Object>) context).orNull();
}
if (context != null) {
return options.fn(context);
} else {
return options.inverse();
}
}
示例3: apply
import com.github.jknack.handlebars.Options; //导入方法依赖的package包/类
@Override
public CharSequence apply(Object param0, Options options) throws IOException {
if(StringUtil.isNullOrEmpty(String.valueOf(param0))){
return options.inverse(this);
}
return options.fn(this);
}
示例4: apply
import com.github.jknack.handlebars.Options; //导入方法依赖的package包/类
@Override
public CharSequence apply(final Object context, final Options options)
throws IOException {
if (options.hash.get("value").equals(context.toString())) {
return options.fn();
} else {
return options.inverse();
}
}
示例5: apply
import com.github.jknack.handlebars.Options; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public CharSequence apply(Object context, Options options) throws IOException {
if (options.tagType.inline()) {
return "";
}
API api = options.data(HbsRenderable.DATA_KEY_API);
Permission permission = getPermission(context, options);
return api.hasPermission(permission) ? options.fn() : options.inverse();
}
示例6: apply
import com.github.jknack.handlebars.Options; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public CharSequence apply(Object context, Options options) throws IOException {
if (context.toString().contains("\n") || context.toString().contains("`")) {
return options.fn();
} else {
return options.inverse();
}
}
示例7: ifContainedIn
import com.github.jknack.handlebars.Options; //导入方法依赖的package包/类
public static CharSequence ifContainedIn(Collection<String> haystack, String needle, Options options) throws IOException {
if (Objects.isNull(haystack)) {
return options.inverse();
}
for (String element : haystack) {
if (element.contains(needle)) {
return options.fn();
}
}
return options.inverse();
}
示例8: ifEqual
import com.github.jknack.handlebars.Options; //导入方法依赖的package包/类
public static CharSequence ifEqual(String v1, String v2, Options options) throws IOException {
if (v1 == null ? v2 == null : v1.equals(v2)) {
return options.fn();
} else {
return options.inverse();
}
}
示例9: ifOptionalEqual
import com.github.jknack.handlebars.Options; //导入方法依赖的package包/类
public static CharSequence ifOptionalEqual(Optional<String> v1, Optional<String> v2, Options options) throws IOException {
if (v1.equals(v2)) {
return options.fn();
} else {
return options.inverse();
}
}
示例10: apply
import com.github.jknack.handlebars.Options; //导入方法依赖的package包/类
@Override
public Object apply(T firstParam, Options options) throws IOException {
T secondParam = options.param(0);
LOGGER.info("compareTo: {} vs {}", firstParam, secondParam);
return firstParam.compareTo(secondParam) >= 0 ? options.fn() : options.inverse();
}
示例11: apply
import com.github.jknack.handlebars.Options; //导入方法依赖的package包/类
@Override
public Object apply(T firstParam, Options options) throws IOException {
T secondParam = options.param(0);
return firstParam.compareTo(secondParam) > 0 ? options.fn() : options.inverse();
}
示例12: apply
import com.github.jknack.handlebars.Options; //导入方法依赖的package包/类
@Override
public Object apply(T firstParam, Options options) throws IOException {
T secondParam = options.param(0);
return firstParam.compareTo(secondParam) < 0 ? options.fn() : options.inverse();
}
示例13: apply
import com.github.jknack.handlebars.Options; //导入方法依赖的package包/类
@Override
public Object apply(T firstParam, Options options) throws IOException {
T secondParam = options.param(0);
return firstParam.compareTo(secondParam) <= 0 ? options.fn() : options.inverse();
}
示例14: apply
import com.github.jknack.handlebars.Options; //导入方法依赖的package包/类
@Override
public Object apply(Number firstParam, Options options) throws IOException {
Number secondParam = options.param(0);
return firstParam.equals(secondParam) ? options.fn() : options.inverse();
}