blob: 20f901c7c948139a133b7582fdc3152cf35eb929 [file] [log] [blame]
limpbizkitafa4b5d2008-08-02 18:40:47 +00001/**
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.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.
limpbizkitc489adf2008-11-18 07:01:33 +000026 *
27 * @since 2.0
limpbizkitafa4b5d2008-08-02 18:40:47 +000028 */
29public 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 */
limpbizkit03b81a62009-03-18 05:34:39 +000035 <T> V visit(Binding<T> binding);
limpbizkitafa4b5d2008-08-02 18:40:47 +000036
limpbizkitbf0d8762009-02-19 09:06:22 +000037 /*if[AOP]*/
limpbizkitafa4b5d2008-08-02 18:40:47 +000038 /**
39 * Visit a registration of interceptors for matching methods of matching classes.
40 */
limpbizkit03b81a62009-03-18 05:34:39 +000041 V visit(InterceptorBinding binding);
limpbizkitbf0d8762009-02-19 09:06:22 +000042 /*end[AOP]*/
limpbizkitafa4b5d2008-08-02 18:40:47 +000043
44 /**
45 * Visit a registration of a scope annotation with the scope that implements it.
46 */
limpbizkit03b81a62009-03-18 05:34:39 +000047 V visit(ScopeBinding binding);
limpbizkitafa4b5d2008-08-02 18:40:47 +000048
49 /**
50 * Visit a registration of type converters for matching target types.
51 */
limpbizkit03b81a62009-03-18 05:34:39 +000052 V visit(TypeConverterBinding binding);
limpbizkitafa4b5d2008-08-02 18:40:47 +000053
54 /**
55 * Visit a request to inject the instance fields and methods of an instance.
56 */
limpbizkit5ae41eb2009-06-06 17:51:27 +000057 V visit(InjectionRequest<?> request);
limpbizkitafa4b5d2008-08-02 18:40:47 +000058
59 /**
60 * Visit a request to inject the static fields and methods of type.
61 */
limpbizkit03b81a62009-03-18 05:34:39 +000062 V visit(StaticInjectionRequest request);
limpbizkitafa4b5d2008-08-02 18:40:47 +000063
64 /**
65 * Visit a lookup of the provider for a type.
66 */
limpbizkit03b81a62009-03-18 05:34:39 +000067 <T> V visit(ProviderLookup<T> lookup);
68
69 /**
70 * Visit a lookup of the members injector.
71 */
72 <T> V visit(MembersInjectorLookup<T> lookup);
limpbizkitafa4b5d2008-08-02 18:40:47 +000073
74 /**
75 * Visit an error message and the context in which it occured.
76 */
limpbizkit03b81a62009-03-18 05:34:39 +000077 V visit(Message message);
limpbizkit5ea4ab22008-11-25 08:43:49 +000078
79 /**
limpbizkit03b81a62009-03-18 05:34:39 +000080 * Visit a collection of configuration elements for a {@linkplain com.google.inject.PrivateBinder
81 * private binder}.
limpbizkit5ea4ab22008-11-25 08:43:49 +000082 */
limpbizkit03b81a62009-03-18 05:34:39 +000083 V visit(PrivateElements elements);
84
85 /**
86 * Visit an injectable type listener binding.
87 */
limpbizkitee792462009-04-08 23:48:49 +000088 V visit(TypeListenerBinding binding);
limpbizkitafa4b5d2008-08-02 18:40:47 +000089}