Registration of interceptors for matching methods of matching classes. Instances are created explicitly in a module using com.google.inject.Binder#bindInterceptor( Matcher, Matcher, MethodInterceptor[]) bindInterceptor() statements: bindInterceptor(Matchers.subclassesOf(MyAction.c
| 42 | * @since 2.0 |
| 43 | */ |
| 44 | public final class InterceptorBinding implements Element { |
| 45 | private final Object source; |
| 46 | private final Matcher<? super Class<?>> classMatcher; |
| 47 | private final Matcher<? super Method> methodMatcher; |
| 48 | private final ImmutableList<MethodInterceptor> interceptors; |
| 49 | |
| 50 | InterceptorBinding( |
| 51 | Object source, |
| 52 | Matcher<? super Class<?>> classMatcher, |
| 53 | Matcher<? super Method> methodMatcher, |
| 54 | MethodInterceptor[] interceptors) { |
| 55 | this.source = checkNotNull(source, "source"); |
| 56 | this.classMatcher = checkNotNull(classMatcher, "classMatcher"); |
| 57 | this.methodMatcher = checkNotNull(methodMatcher, "methodMatcher"); |
| 58 | this.interceptors = ImmutableList.copyOf(interceptors); |
| 59 | } |
| 60 | |
| 61 | @Override |
| 62 | public Object getSource() { |
| 63 | return source; |
| 64 | } |
| 65 | |
| 66 | public Matcher<? super Class<?>> getClassMatcher() { |
| 67 | return classMatcher; |
| 68 | } |
| 69 | |
| 70 | public Matcher<? super Method> getMethodMatcher() { |
| 71 | return methodMatcher; |
| 72 | } |
| 73 | |
| 74 | public List<MethodInterceptor> getInterceptors() { |
| 75 | return interceptors; |
| 76 | } |
| 77 | |
| 78 | @Override |
| 79 | public <T> T acceptVisitor(ElementVisitor<T> visitor) { |
| 80 | return visitor.visit(this); |
| 81 | } |
| 82 | |
| 83 | @Override |
| 84 | public void applyTo(Binder binder) { |
| 85 | binder |
| 86 | .withSource(getSource()) |
| 87 | .bindInterceptor( |
| 88 | classMatcher, |
| 89 | methodMatcher, |
| 90 | interceptors.toArray(new MethodInterceptor[interceptors.size()])); |
| 91 | } |
| 92 | } |
nothing calls this directly
no outgoing calls
no test coverage detected