• 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 {@code return null}
27  *     if no return type is needed.
28  * @since 2.0
29  */
30 public interface ElementVisitor<V> {
31 
32   /**
33    * Visit a mapping from a key (type and optional annotation) to the strategy for getting instances
34    * of the type.
35    */
visit(Binding<T> binding)36   <T> V visit(Binding<T> binding);
37 
38   /*if[AOP]*/
39   /** Visit a registration of interceptors for matching methods of matching classes. */
visit(InterceptorBinding binding)40   V visit(InterceptorBinding binding);
41   /*end[AOP]*/
42 
43   /** Visit a registration of a scope annotation with the scope that implements it. */
visit(ScopeBinding binding)44   V visit(ScopeBinding binding);
45 
46   /** Visit a registration of type converters for matching target types. */
visit(TypeConverterBinding binding)47   V visit(TypeConverterBinding binding);
48 
49   /** Visit a request to inject the instance fields and methods of an instance. */
visit(InjectionRequest<?> request)50   V visit(InjectionRequest<?> request);
51 
52   /** Visit a request to inject the static fields and methods of type. */
visit(StaticInjectionRequest request)53   V visit(StaticInjectionRequest request);
54 
55   /** Visit a lookup of the provider for a type. */
visit(ProviderLookup<T> lookup)56   <T> V visit(ProviderLookup<T> lookup);
57 
58   /** Visit a lookup of the members injector. */
visit(MembersInjectorLookup<T> lookup)59   <T> V visit(MembersInjectorLookup<T> lookup);
60 
61   /** Visit an error message and the context in which it occured. */
visit(Message message)62   V visit(Message message);
63 
64   /**
65    * Visit a collection of configuration elements for a {@linkplain com.google.inject.PrivateBinder
66    * private binder}.
67    */
visit(PrivateElements elements)68   V visit(PrivateElements elements);
69 
70   /** Visit an injectable type listener binding. */
visit(TypeListenerBinding binding)71   V visit(TypeListenerBinding binding);
72 
73   /**
74    * Visit a provision listener binding.
75    *
76    * @since 4.0
77    */
visit(ProvisionListenerBinding binding)78   V visit(ProvisionListenerBinding binding);
79 
80   /**
81    * Visit a require explicit bindings command.
82    *
83    * @since 3.0
84    */
visit(RequireExplicitBindingsOption option)85   V visit(RequireExplicitBindingsOption option);
86 
87   /**
88    * Visit a disable circular proxies command.
89    *
90    * @since 3.0
91    */
visit(DisableCircularProxiesOption option)92   V visit(DisableCircularProxiesOption option);
93 
94   /**
95    * Visit a require explicit {@literal @}{@link Inject} command.
96    *
97    * @since 4.0
98    */
visit(RequireAtInjectOnConstructorsOption option)99   V visit(RequireAtInjectOnConstructorsOption option);
100 
101   /**
102    * Visit a require exact binding annotations command.
103    *
104    * @since 4.0
105    */
visit(RequireExactBindingAnnotationsOption option)106   V visit(RequireExactBindingAnnotationsOption option);
107 
108   /**
109    * Visits a {@link Binder#scanModulesForAnnotatedMethods} command.
110    *
111    * @since 4.0
112    */
visit(ModuleAnnotatedMethodScannerBinding binding)113   V visit(ModuleAnnotatedMethodScannerBinding binding);
114 }
115