Search in sources :

Example 1 with InterceptorRefs

use of org.apache.struts2.convention.annotation.InterceptorRefs in project struts by apache.

the class DefaultInterceptorMapBuilder method build.

public List<InterceptorMapping> build(Class<?> actionClass, PackageConfig.Builder builder, String actionName, Action annotation) {
    List<InterceptorMapping> interceptorList = new ArrayList<>(10);
    // from @InterceptorRefs annotation
    InterceptorRefs interceptorRefs = AnnotationUtils.findAnnotation(actionClass, InterceptorRefs.class);
    if (interceptorRefs != null)
        interceptorList.addAll(build(interceptorRefs.value(), actionName, builder));
    // from @InterceptorRef annotation
    InterceptorRef interceptorRef = AnnotationUtils.findAnnotation(actionClass, InterceptorRef.class);
    if (interceptorRef != null)
        interceptorList.addAll(build(new InterceptorRef[] { interceptorRef }, actionName, builder));
    // from @Action annotation
    if (annotation != null) {
        InterceptorRef[] interceptors = annotation.interceptorRefs();
        if (interceptors != null) {
            interceptorList.addAll(build(interceptors, actionName, builder));
        }
    }
    return interceptorList;
}
Also used : ArrayList(java.util.ArrayList) InterceptorRef(org.apache.struts2.convention.annotation.InterceptorRef) InterceptorMapping(com.opensymphony.xwork2.config.entities.InterceptorMapping) InterceptorRefs(org.apache.struts2.convention.annotation.InterceptorRefs)

Aggregations

InterceptorMapping (com.opensymphony.xwork2.config.entities.InterceptorMapping)1 ArrayList (java.util.ArrayList)1 InterceptorRef (org.apache.struts2.convention.annotation.InterceptorRef)1 InterceptorRefs (org.apache.struts2.convention.annotation.InterceptorRefs)1