1/**
2 * Copyright (C) 2008 Google Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.google.inject.spi;
18
19import com.google.inject.Binder;
20import com.google.inject.Binding;
21import com.google.inject.Inject;
22
23/**
24 * Visit elements.
25 *
26 * @param <V> any type to be returned by the visit method. Use {@link Void} with
27 *     {@code return null} if no return type is needed.
28 *
29 * @since 2.0
30 */
31public interface ElementVisitor<V> {
32
33  /**
34   * Visit a mapping from a key (type and optional annotation) to the strategy for getting
35   * instances of the type.
36   */
37  <T> V visit(Binding<T> binding);
38
39  /*if[AOP]*/
40  /**
41   * Visit a registration of interceptors for matching methods of matching classes.
42   */
43  V visit(InterceptorBinding binding);
44  /*end[AOP]*/
45
46  /**
47   * Visit a registration of a scope annotation with the scope that implements it.
48   */
49  V visit(ScopeBinding binding);
50
51  /**
52   * Visit a registration of type converters for matching target types.
53   */
54  V visit(TypeConverterBinding binding);
55
56  /**
57   * Visit a request to inject the instance fields and methods of an instance.
58   */
59  V visit(InjectionRequest<?> request);
60
61  /**
62   * Visit a request to inject the static fields and methods of type.
63   */
64  V visit(StaticInjectionRequest request);
65
66  /**
67   * Visit a lookup of the provider for a type.
68   */
69  <T> V visit(ProviderLookup<T> lookup);
70
71  /**
72   * Visit a lookup of the members injector.
73   */
74  <T> V visit(MembersInjectorLookup<T> lookup);
75
76  /**
77   * Visit an error message and the context in which it occured.
78   */
79  V visit(Message message);
80
81  /**
82   * Visit a collection of configuration elements for a {@linkplain com.google.inject.PrivateBinder
83   * private binder}.
84   */
85  V visit(PrivateElements elements);
86
87  /**
88   * Visit an injectable type listener binding.
89   */
90  V visit(TypeListenerBinding binding);
91
92  /**
93   * Visit a provision listener binding.
94   *
95   * @since 4.0
96   */
97  V visit(ProvisionListenerBinding binding);
98
99  /**
100   * Visit a require explicit bindings command.
101   *
102   * @since 3.0
103   */
104  V visit(RequireExplicitBindingsOption option);
105
106  /**
107   * Visit a disable circular proxies command.
108   *
109   * @since 3.0
110   */
111  V visit(DisableCircularProxiesOption option);
112
113  /**
114   * Visit a require explicit {@literal @}{@link Inject} command.
115   *
116   * @since 4.0
117   */
118  V visit(RequireAtInjectOnConstructorsOption option);
119
120  /**
121   * Visit a require exact binding annotations command.
122   *
123   * @since 4.0
124   */
125  V visit(RequireExactBindingAnnotationsOption option);
126
127  /**
128   * Visits a {@link Binder#scanModulesForAnnotatedMethods} command.
129   *
130   * @since 4.0
131   */
132  V visit(ModuleAnnotatedMethodScannerBinding binding);
133}
134