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
15package com.google.inject.servlet;
16
17import com.google.inject.servlet.ServletModule.FilterKeyBindingBuilder;
18import com.google.inject.servlet.ServletModule.ServletKeyBindingBuilder;
19import com.google.inject.spi.BindingTargetVisitor;
20
21import javax.servlet.Filter;
22import javax.servlet.http.HttpServlet;
23
24/**
25 * A visitor for the servlet extension.
26 *
27 * If your {@link BindingTargetVisitor} implements this interface, bindings created by using
28 * {@link ServletModule} will be visited through this interface.
29 *
30 * @since 3.0
31 * @author sameb@google.com (Sam Berlin)
32 */
33public interface ServletModuleTargetVisitor<T, V> extends BindingTargetVisitor<T, V> {
34
35  /**
36   * Visits a filter binding created by {@link ServletModule#filter}, where
37   * {@link FilterKeyBindingBuilder#through} is called with a Class or Key.
38   *
39   * If multiple patterns were specified, this will be called multiple times.
40   */
41  V visit(LinkedFilterBinding binding);
42
43  /**
44   * Visits a filter binding created by {@link ServletModule#filter} where
45   * {@link FilterKeyBindingBuilder#through} is called with a {@link Filter}.
46   *
47   * If multiple patterns were specified, this will be called multiple times.
48   */
49  V visit(InstanceFilterBinding binding);
50
51  /**
52   * Visits a servlet binding created by {@link ServletModule#serve} where
53   * {@link ServletKeyBindingBuilder#with}, is called with a Class or Key.
54   *
55   * If multiple patterns were specified, this will be called multiple times.
56   */
57  V visit(LinkedServletBinding binding);
58
59  /**
60   * Visits a servlet binding created by {@link ServletModule#serve} where
61   * {@link ServletKeyBindingBuilder#with}, is called with an {@link HttpServlet}.
62   *
63   * If multiple patterns were specified, this will be called multiple times.
64   */
65  V visit(InstanceServletBinding binding);
66}