• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
17 package com.google.inject.spi;
18 
19 import com.google.inject.Binder;
20 import com.google.inject.Binding;
21 import 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  */
31 public 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    */
visit(Binding<T> binding)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    */
visit(InterceptorBinding binding)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    */
visit(ScopeBinding binding)49   V visit(ScopeBinding binding);
50 
51   /**
52    * Visit a registration of type converters for matching target types.
53    */
visit(TypeConverterBinding binding)54   V visit(TypeConverterBinding binding);
55 
56   /**
57    * Visit a request to inject the instance fields and methods of an instance.
58    */
visit(InjectionRequest<?> request)59   V visit(InjectionRequest<?> request);
60 
61   /**
62    * Visit a request to inject the static fields and methods of type.
63    */
visit(StaticInjectionRequest request)64   V visit(StaticInjectionRequest request);
65 
66   /**
67    * Visit a lookup of the provider for a type.
68    */
visit(ProviderLookup<T> lookup)69   <T> V visit(ProviderLookup<T> lookup);
70 
71   /**
72    * Visit a lookup of the members injector.
73    */
visit(MembersInjectorLookup<T> lookup)74   <T> V visit(MembersInjectorLookup<T> lookup);
75 
76   /**
77    * Visit an error message and the context in which it occured.
78    */
visit(Message message)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    */
visit(PrivateElements elements)85   V visit(PrivateElements elements);
86 
87   /**
88    * Visit an injectable type listener binding.
89    */
visit(TypeListenerBinding binding)90   V visit(TypeListenerBinding binding);
91 
92   /**
93    * Visit a provision listener binding.
94    *
95    * @since 4.0
96    */
visit(ProvisionListenerBinding binding)97   V visit(ProvisionListenerBinding binding);
98 
99   /**
100    * Visit a require explicit bindings command.
101    *
102    * @since 3.0
103    */
visit(RequireExplicitBindingsOption option)104   V visit(RequireExplicitBindingsOption option);
105 
106   /**
107    * Visit a disable circular proxies command.
108    *
109    * @since 3.0
110    */
visit(DisableCircularProxiesOption option)111   V visit(DisableCircularProxiesOption option);
112 
113   /**
114    * Visit a require explicit {@literal @}{@link Inject} command.
115    *
116    * @since 4.0
117    */
visit(RequireAtInjectOnConstructorsOption option)118   V visit(RequireAtInjectOnConstructorsOption option);
119 
120   /**
121    * Visit a require exact binding annotations command.
122    *
123    * @since 4.0
124    */
visit(RequireExactBindingAnnotationsOption option)125   V visit(RequireExactBindingAnnotationsOption option);
126 
127   /**
128    * Visits a {@link Binder#scanModulesForAnnotatedMethods} command.
129    *
130    * @since 4.0
131    */
visit(ModuleAnnotatedMethodScannerBinding binding)132   V visit(ModuleAnnotatedMethodScannerBinding binding);
133 }
134