limpbizkit | afa4b5d | 2008-08-02 18:40:47 +0000 | [diff] [blame] | 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.Binding; |
| 20 | |
| 21 | /** |
| 22 | * Visit elements. |
| 23 | * |
| 24 | * @param <V> any type to be returned by the visit method. Use {@link Void} with |
| 25 | * {@code return null} if no return type is needed. |
limpbizkit | c489adf | 2008-11-18 07:01:33 +0000 | [diff] [blame] | 26 | * |
| 27 | * @since 2.0 |
limpbizkit | afa4b5d | 2008-08-02 18:40:47 +0000 | [diff] [blame] | 28 | */ |
| 29 | public interface ElementVisitor<V> { |
| 30 | |
| 31 | /** |
| 32 | * Visit a mapping from a key (type and optional annotation) to the strategy for getting |
| 33 | * instances of the type. |
| 34 | */ |
limpbizkit | 03b81a6 | 2009-03-18 05:34:39 +0000 | [diff] [blame] | 35 | <T> V visit(Binding<T> binding); |
limpbizkit | afa4b5d | 2008-08-02 18:40:47 +0000 | [diff] [blame] | 36 | |
limpbizkit | bf0d876 | 2009-02-19 09:06:22 +0000 | [diff] [blame] | 37 | /*if[AOP]*/ |
limpbizkit | afa4b5d | 2008-08-02 18:40:47 +0000 | [diff] [blame] | 38 | /** |
| 39 | * Visit a registration of interceptors for matching methods of matching classes. |
| 40 | */ |
limpbizkit | 03b81a6 | 2009-03-18 05:34:39 +0000 | [diff] [blame] | 41 | V visit(InterceptorBinding binding); |
limpbizkit | bf0d876 | 2009-02-19 09:06:22 +0000 | [diff] [blame] | 42 | /*end[AOP]*/ |
limpbizkit | afa4b5d | 2008-08-02 18:40:47 +0000 | [diff] [blame] | 43 | |
| 44 | /** |
| 45 | * Visit a registration of a scope annotation with the scope that implements it. |
| 46 | */ |
limpbizkit | 03b81a6 | 2009-03-18 05:34:39 +0000 | [diff] [blame] | 47 | V visit(ScopeBinding binding); |
limpbizkit | afa4b5d | 2008-08-02 18:40:47 +0000 | [diff] [blame] | 48 | |
| 49 | /** |
| 50 | * Visit a registration of type converters for matching target types. |
| 51 | */ |
limpbizkit | 03b81a6 | 2009-03-18 05:34:39 +0000 | [diff] [blame] | 52 | V visit(TypeConverterBinding binding); |
limpbizkit | afa4b5d | 2008-08-02 18:40:47 +0000 | [diff] [blame] | 53 | |
| 54 | /** |
| 55 | * Visit a request to inject the instance fields and methods of an instance. |
| 56 | */ |
limpbizkit | 5ae41eb | 2009-06-06 17:51:27 +0000 | [diff] [blame^] | 57 | V visit(InjectionRequest<?> request); |
limpbizkit | afa4b5d | 2008-08-02 18:40:47 +0000 | [diff] [blame] | 58 | |
| 59 | /** |
| 60 | * Visit a request to inject the static fields and methods of type. |
| 61 | */ |
limpbizkit | 03b81a6 | 2009-03-18 05:34:39 +0000 | [diff] [blame] | 62 | V visit(StaticInjectionRequest request); |
limpbizkit | afa4b5d | 2008-08-02 18:40:47 +0000 | [diff] [blame] | 63 | |
| 64 | /** |
| 65 | * Visit a lookup of the provider for a type. |
| 66 | */ |
limpbizkit | 03b81a6 | 2009-03-18 05:34:39 +0000 | [diff] [blame] | 67 | <T> V visit(ProviderLookup<T> lookup); |
| 68 | |
| 69 | /** |
| 70 | * Visit a lookup of the members injector. |
| 71 | */ |
| 72 | <T> V visit(MembersInjectorLookup<T> lookup); |
limpbizkit | afa4b5d | 2008-08-02 18:40:47 +0000 | [diff] [blame] | 73 | |
| 74 | /** |
| 75 | * Visit an error message and the context in which it occured. |
| 76 | */ |
limpbizkit | 03b81a6 | 2009-03-18 05:34:39 +0000 | [diff] [blame] | 77 | V visit(Message message); |
limpbizkit | 5ea4ab2 | 2008-11-25 08:43:49 +0000 | [diff] [blame] | 78 | |
| 79 | /** |
limpbizkit | 03b81a6 | 2009-03-18 05:34:39 +0000 | [diff] [blame] | 80 | * Visit a collection of configuration elements for a {@linkplain com.google.inject.PrivateBinder |
| 81 | * private binder}. |
limpbizkit | 5ea4ab2 | 2008-11-25 08:43:49 +0000 | [diff] [blame] | 82 | */ |
limpbizkit | 03b81a6 | 2009-03-18 05:34:39 +0000 | [diff] [blame] | 83 | V visit(PrivateElements elements); |
| 84 | |
| 85 | /** |
| 86 | * Visit an injectable type listener binding. |
| 87 | */ |
limpbizkit | ee79246 | 2009-04-08 23:48:49 +0000 | [diff] [blame] | 88 | V visit(TypeListenerBinding binding); |
limpbizkit | afa4b5d | 2008-08-02 18:40:47 +0000 | [diff] [blame] | 89 | } |