Search in sources :

Example 1 with TagVarBinding

use of org.beetl.core.TagVarBinding in project beetl2.0 by javamonkey.

the class HTMLTagVarBindingWrapper method init.

public void init(Context ctx, Object[] args, Statement st) {
    super.init(ctx, args, st);
    if (args.length == 0 || args.length > 3) {
        throw new RuntimeException("参数错误,期望child,Map .....");
    }
    String child = (String) args[0];
    // 已经注册的Tag
    TagFactory tagFactory = null;
    String functionTagName = child.replace(':', '.');
    tagFactory = this.gt.getTagFactory(functionTagName);
    if (tagFactory == null) {
        throw new RuntimeException("标签初始化错误,未找到指定的标签实现类" + functionTagName);
    }
    tag = tagFactory.createTag();
    if (tag == null) {
        throw new RuntimeException("找不到注册的Tag");
    } else if (!(tag instanceof TagVarBinding)) {
        throw new RuntimeException(tag.getClass() + " 必须是TagVarBinding的实现类");
    }
    tag.init(ctx, args, st);
}
Also used : TagFactory(org.beetl.core.TagFactory) TagVarBinding(org.beetl.core.TagVarBinding)

Aggregations

TagFactory (org.beetl.core.TagFactory)1 TagVarBinding (org.beetl.core.TagVarBinding)1