1e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit/**
2e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit * Copyright (C) 2007 Google Inc.
3e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit *
4e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit * Licensed under the Apache License, Version 2.0 (the "License");
5e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit * you may not use this file except in compliance with the License.
6e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit * You may obtain a copy of the License at
7e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit *
8e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit * http://www.apache.org/licenses/LICENSE-2.0
9e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit *
10e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit * Unless required by applicable law or agreed to in writing, software
11e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit * distributed under the License is distributed on an "AS IS" BASIS,
12e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit * See the License for the specific language governing permissions and
14e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit * limitations under the License.
15e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit */
16e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit
17e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkitpackage com.google.inject.assistedinject;
18e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit
19e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkitimport static java.lang.annotation.ElementType.CONSTRUCTOR;
20e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkitimport static java.lang.annotation.RetentionPolicy.RUNTIME;
21e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit
22b5ec94a953eb64b773e56658f50e728f47519288sberlinimport com.google.inject.Inject;
23b5ec94a953eb64b773e56658f50e728f47519288sberlin
24b7a02b02d81c830d148355c90bc309bcd66fb592sberlinimport java.lang.annotation.Retention;
25b7a02b02d81c830d148355c90bc309bcd66fb592sberlinimport java.lang.annotation.Target;
26b7a02b02d81c830d148355c90bc309bcd66fb592sberlin
27e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit/**
28b5ec94a953eb64b773e56658f50e728f47519288sberlin * <p>
29b5ec94a953eb64b773e56658f50e728f47519288sberlin * When used in tandem with {@link FactoryModuleBuilder}, constructors annotated with
30b5ec94a953eb64b773e56658f50e728f47519288sberlin * {@code @AssistedInject} indicate that multiple constructors can be injected, each with different
31b5ec94a953eb64b773e56658f50e728f47519288sberlin * parameters. AssistedInject annotations should not be mixed with {@literal @}{@link Inject}
32b5ec94a953eb64b773e56658f50e728f47519288sberlin * annotations. The assisted parameters must exactly match one corresponding factory method within
33b5ec94a953eb64b773e56658f50e728f47519288sberlin * the factory interface, but the parameters do not need to be in the same order. Constructors
34b5ec94a953eb64b773e56658f50e728f47519288sberlin * annotated with AssistedInject <b>are</b> created by Guice and receive all the benefits
35b5ec94a953eb64b773e56658f50e728f47519288sberlin * (such as AOP).
36b5ec94a953eb64b773e56658f50e728f47519288sberlin *
37b5ec94a953eb64b773e56658f50e728f47519288sberlin * <p>
38b5ec94a953eb64b773e56658f50e728f47519288sberlin * <strong>Obsolete Usage:</strong> When used in tandem with {@link FactoryProvider}, constructors
39b5ec94a953eb64b773e56658f50e728f47519288sberlin * annotated with {@code @AssistedInject} trigger a "backwards compatibility mode". The assisted
40b5ec94a953eb64b773e56658f50e728f47519288sberlin * parameters must exactly match one corresponding factory method within the factory interface and
41b5ec94a953eb64b773e56658f50e728f47519288sberlin * all must be in the same order as listed in the factory. In this backwards compatable mode,
42b5ec94a953eb64b773e56658f50e728f47519288sberlin * constructors annotated with AssistedInject <b>are not</b> created by Guice and thus receive
43b5ec94a953eb64b773e56658f50e728f47519288sberlin * none of the benefits.
44e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit *
45b5ec94a953eb64b773e56658f50e728f47519288sberlin * <p>
46b5ec94a953eb64b773e56658f50e728f47519288sberlin * Constructor parameters must be either supplied by the factory interface and marked with
472d633cd04273a80a31c920f24fc1d3c5f1f8e7dflimpbizkit * <code>@Assisted</code>, or they must be injectable.
48e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit *
49e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit * @author jmourits@google.com (Jerome Mourits)
50e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit * @author jessewilson@google.com (Jesse Wilson)
51e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit */
52b5ec94a953eb64b773e56658f50e728f47519288sberlin@Target( { CONSTRUCTOR })
53e451ef79c95a19a0e8044567f133f0ad1a40f4bclimpbizkit@Retention(RUNTIME)
54b5ec94a953eb64b773e56658f50e728f47519288sberlinpublic @interface AssistedInject {
55b5ec94a953eb64b773e56658f50e728f47519288sberlin}
56