blob: 087d6cafce108c64b4428811d1a1b080a7f91fe9 [file] [log] [blame]
crazyboblee66b415a2006-08-25 02:01:19 +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
kevinb9na99dca72007-02-11 04:48:57 +000019import static java.lang.annotation.ElementType.CONSTRUCTOR;
20import static java.lang.annotation.ElementType.FIELD;
21import static java.lang.annotation.ElementType.METHOD;
22import static java.lang.annotation.ElementType.PARAMETER;
crazyboblee66b415a2006-08-25 02:01:19 +000023import java.lang.annotation.Retention;
kevinb9na99dca72007-02-11 04:48:57 +000024import static java.lang.annotation.RetentionPolicy.RUNTIME;
crazyboblee66b415a2006-08-25 02:01:19 +000025import java.lang.annotation.Target;
26
27/**
28 * <p>Annotates members and parameters which should have their value[s]
29 * injected.
30 *
31 * @author crazybob@google.com (Bob Lee)
32 */
kevinb9na99dca72007-02-11 04:48:57 +000033@Target({ METHOD, CONSTRUCTOR, FIELD, PARAMETER })
crazyboblee66b415a2006-08-25 02:01:19 +000034@Retention(RUNTIME)
35public @interface Inject {
36
37 /**
crazyboblee6ab7e1f2006-12-02 00:20:36 +000038 * Dependency name. Defaults to {@link Key#DEFAULT_NAME}.
crazyboblee66b415a2006-08-25 02:01:19 +000039 */
crazyboblee6ab7e1f2006-12-02 00:20:36 +000040 String value() default Key.DEFAULT_NAME;
crazyboblee66b415a2006-08-25 02:01:19 +000041
42 /**
kevinb9na99dca72007-02-11 04:48:57 +000043 * Whether or not injection is required. Applicable only to methods and fields
44 * (not constructors or parameters).
crazyboblee66b415a2006-08-25 02:01:19 +000045 */
46 boolean required() default true;
47}