blob: 71d620f84f2894b6309532a6f120076f6abe307f [file] [log] [blame]
limpbizkit009bb092008-05-07 06:36:02 +00001/**
2 * Copyright (C) 2006 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;
18
limpbizkita843a952009-04-08 22:24:55 +000019import com.google.inject.internal.ImmutableMap;
limpbizkita98bc7a2008-08-29 16:52:44 +000020import com.google.inject.spi.InjectionPoint;
limpbizkit185d2a22008-06-16 07:22:47 +000021import java.lang.reflect.Constructor;
limpbizkit009bb092008-05-07 06:36:02 +000022import java.lang.reflect.InvocationTargetException;
limpbizkit696c5cd2008-12-30 21:48:17 +000023import java.lang.reflect.Method;
24import java.util.List;
limpbizkit009bb092008-05-07 06:36:02 +000025
26/**
27 * Proxies calls to a {@link java.lang.reflect.Constructor} for a class
28 * {@code T}.
29 *
30 * @author crazybob@google.com (Bob Lee)
31 */
32interface ConstructionProxy<T> {
33
34 /**
35 * Constructs an instance of {@code T} for the given arguments.
36 */
37 T newInstance(Object... arguments) throws InvocationTargetException;
38
limpbizkita98bc7a2008-08-29 16:52:44 +000039 /**
40 * Returns the injection point for this constructor.
41 */
42 InjectionPoint getInjectionPoint();
limpbizkit009bb092008-05-07 06:36:02 +000043
44 /**
limpbizkit185d2a22008-06-16 07:22:47 +000045 * Returns the injected constructor. If the injected constructor is synthetic (such as generated
46 * code for method interception), the natural constructor is returned.
limpbizkit009bb092008-05-07 06:36:02 +000047 */
limpbizkit477f9f92008-07-28 07:05:14 +000048 Constructor<T> getConstructor();
limpbizkit696c5cd2008-12-30 21:48:17 +000049
limpbizkitbf0d8762009-02-19 09:06:22 +000050 /*if[AOP]*/
limpbizkit696c5cd2008-12-30 21:48:17 +000051 /**
52 * Returns the interceptors applied to each method, in order of invocation.
53 */
limpbizkiteb405132009-04-14 00:50:25 +000054 ImmutableMap<Method, List<org.aopalliance.intercept.MethodInterceptor>> getMethodInterceptors();
limpbizkitbf0d8762009-02-19 09:06:22 +000055 /*end[AOP]*/
limpbizkit009bb092008-05-07 06:36:02 +000056}