程序包 org.beetl.core
接口 Function
public interface Function
Beetl 的函数接口,用户可以通过实现此接口来自定一方法
例如实现一个将字符创转为大写的函数 str.upcase
str.upcase 接收一个字符串参数,并将其转为大写,如下调用
hello,this is ${str.upcase(user.name)}
group.registerFunction("str.upcase", new Function() {
public String call(Object[] paras, Context ctx) {
String str = (String) paras[0];
return str.toUpperCase();
}
});
- 从以下版本开始:
- 1.1
- 作者:
- xiandafu
-
嵌套类概要
嵌套类修饰符和类型接口说明static interface如果Function实现了此接口,则入参会在解析的时候修改static interface如果Function还实现了此接口,则此函数参数将使用安全输出符号static interface如果Function实现了此接口,则会添加额当前外行参 -
方法概要
-
方法详细资料
-
call
- 参数:
paras- beetl传递的参数
-