package cd.casic.plugin.core.register.filter.impl;

import cd.casic.plugin.core.register.filter.PluginClassFilter;
import cd.casic.plugin.utils.AnnotationUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

/**
 * Controller 过滤器，筛选带有Controller或者RestController注解的类
 */
public class ControllerFilter implements PluginClassFilter {
    public static final String GROUP_NAME = "spring_controller";

    @Override
    public String groupName() {
        return GROUP_NAME;
    }

    @Override
    public void initialize() {

    }

    @Override
    public boolean filter(Class<?> clazz) {
        return AnnotationUtils.hasAnnotations(clazz, false, Controller.class, RestController.class);
    }
}
