private List<HttpRequestFilter> getFiltersIfAnnotated(Invocation invocation) {
List<HttpRequestFilter> filters = newArrayList();
if (invocation.getInvokable().getOwnerType().getRawType().isAnnotationPresent(RequestFilters.class)) {
for (Class<? extends HttpRequestFilter> clazz : invocation.getInvokable().getOwnerType().getRawType()
.getAnnotation(RequestFilters.class).value()) {
HttpRequestFilter instance = injector.getInstance(clazz);
filters.add(instance);
logger.trace("adding filter %s from annotation on %s", instance, invocation.getInvokable().getOwnerType()
.getRawType().getName());
}
}
if (invocation.getInvokable().isAnnotationPresent(RequestFilters.class)) {
if (invocation.getInvokable().isAnnotationPresent(OverrideRequestFilters.class))
filters.clear();
for (Class<? extends HttpRequestFilter> clazz : invocation.getInvokable().getAnnotation(RequestFilters.class)
.value()) {
HttpRequestFilter instance = injector.getInstance(clazz);
filters.add(instance);
logger.trace("adding filter %s from annotation on %s", instance, invocation.getInvokable().getName());
}
}
return filters;