1 /*
2  * Copyright (C) 2010 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5  * in compliance with the License. You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software distributed under the License
10  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11  * or implied. See the License for the specific language governing permissions and limitations under
12  * the License.
13  */
14 
15 package com.google.inject.servlet;
16 
17 import com.google.inject.servlet.ServletModule.FilterKeyBindingBuilder;
18 import com.google.inject.servlet.ServletModule.ServletKeyBindingBuilder;
19 import com.google.inject.spi.BindingTargetVisitor;
20 import javax.servlet.Filter;
21 import javax.servlet.http.HttpServlet;
22 
23 /**
24  * A visitor for the servlet extension.
25  *
26  * <p>If your {@link BindingTargetVisitor} implements this interface, bindings created by using
27  * {@link ServletModule} will be visited through this interface.
28  *
29  * @since 3.0
30  * @author sameb@google.com (Sam Berlin)
31  */
32 public interface ServletModuleTargetVisitor<T, V> extends BindingTargetVisitor<T, V> {
33 
34   /**
35    * Visits a filter binding created by {@link ServletModule#filter}, where {@link
36    * FilterKeyBindingBuilder#through} is called with a Class or Key.
37    *
38    * <p>If multiple patterns were specified, this will be called multiple times.
39    */
visit(LinkedFilterBinding binding)40   V visit(LinkedFilterBinding binding);
41 
42   /**
43    * Visits a filter binding created by {@link ServletModule#filter} where {@link
44    * FilterKeyBindingBuilder#through} is called with a {@link Filter}.
45    *
46    * <p>If multiple patterns were specified, this will be called multiple times.
47    */
visit(InstanceFilterBinding binding)48   V visit(InstanceFilterBinding binding);
49 
50   /**
51    * Visits a servlet binding created by {@link ServletModule#serve} where {@link
52    * ServletKeyBindingBuilder#with}, is called with a Class or Key.
53    *
54    * <p>If multiple patterns were specified, this will be called multiple times.
55    */
visit(LinkedServletBinding binding)56   V visit(LinkedServletBinding binding);
57 
58   /**
59    * Visits a servlet binding created by {@link ServletModule#serve} where {@link
60    * ServletKeyBindingBuilder#with}, is called with an {@link HttpServlet}.
61    *
62    * <p>If multiple patterns were specified, this will be called multiple times.
63    */
visit(InstanceServletBinding binding)64   V visit(InstanceServletBinding binding);
65 }
66