private boolean matches(StaplerRequest request) { String method = request.getMethod(); for (Annotation a : target.getAnnotations()) { Class<? extends Annotation> t = a.annotationType(); InterceptorAnnotation ia = t.getAnnotation(InterceptorAnnotation.class); if (ia != null && ia.value() == HttpVerbInterceptor.class) { if (t.getSimpleName().equals(method)) { return true; } } } return false; } }
final Function wrapByInterceptors(AnnotatedElement m) { try { Function f = this; for (Annotation a : m.getAnnotations()) { final InterceptorAnnotation ia = a.annotationType().getAnnotation(InterceptorAnnotation.class); if (ia!=null) { try { Interceptor i = ia.value().newInstance(); switch (ia.stage()) { case SELECTION: f = new SelectionInterceptedFunction(f,i); break; case PREINVOKE: f = new PreInvokeInterceptedFunction(f,i); break; } } catch (InstantiationException e) { throw (Error)new InstantiationError("Failed to instantiate interceptor for "+f.getDisplayName()).initCause(e); } catch (IllegalAccessException e) { throw (Error)new IllegalAccessError("Failed to instantiate interceptor for "+f.getDisplayName()).initCause(e); } } } return f; } catch (LinkageError e) { // running in JDK 1.4 return this; } }
final Function wrapByInterceptors(AnnotatedElement m) { try { Function f = this; for (Annotation a : m.getAnnotations()) { final InterceptorAnnotation ia = a.annotationType().getAnnotation(InterceptorAnnotation.class); if (ia!=null) { try { Interceptor i = ia.value().newInstance(); switch (ia.stage()) { case SELECTION: f = new SelectionInterceptedFunction(f,i); break; case PREINVOKE: f = new PreInvokeInterceptedFunction(f,i); break; } } catch (InstantiationException e) { throw (Error)new InstantiationError("Failed to instantiate interceptor for "+f.getDisplayName()).initCause(e); } catch (IllegalAccessException e) { throw (Error)new IllegalAccessError("Failed to instantiate interceptor for "+f.getDisplayName()).initCause(e); } } } return f; } catch (LinkageError e) { // running in JDK 1.4 return this; } }
private boolean matches(StaplerRequest request) { String method = request.getMethod(); for (Annotation a : target.getAnnotations()) { Class<? extends Annotation> t = a.annotationType(); InterceptorAnnotation ia = t.getAnnotation(InterceptorAnnotation.class); if (ia != null && ia.value() == HttpVerbInterceptor.class) { if (t.getSimpleName().equals(method)) { return true; } } } return false; } }