package cn.reghao.bnt.web.template.directive;

import cn.reghao.bnt.web.template.DirectiveHandler;
import cn.reghao.bnt.web.template.TemplateDirective;
import org.springframework.stereotype.Component;

/**
 * 处理 @controls 自定义标签
 *
 * created by langhsu
 * on 2019/1/18
 */
@Component
public class ControlsDirective extends TemplateDirective {
    @Override
    public String getName() {
        return "controls";
    }

    @Override
    public void execute(DirectiveHandler handler) throws Exception {
        String control = handler.getString("name");
        if (control.isBlank()) {
            return;
        }

        handler.render();
    }
}
