crazyboblee | 66b415a | 2006-08-25 02:01:19 +0000 | [diff] [blame] | 1 | /** |
| 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 | |
| 17 | package com.google.inject; |
| 18 | |
kevinb9n | a99dca7 | 2007-02-11 04:48:57 +0000 | [diff] [blame] | 19 | import static java.lang.annotation.ElementType.CONSTRUCTOR; |
| 20 | import static java.lang.annotation.ElementType.FIELD; |
| 21 | import static java.lang.annotation.ElementType.METHOD; |
| 22 | import static java.lang.annotation.ElementType.PARAMETER; |
crazyboblee | 66b415a | 2006-08-25 02:01:19 +0000 | [diff] [blame] | 23 | import java.lang.annotation.Retention; |
kevinb9n | a99dca7 | 2007-02-11 04:48:57 +0000 | [diff] [blame] | 24 | import static java.lang.annotation.RetentionPolicy.RUNTIME; |
crazyboblee | 66b415a | 2006-08-25 02:01:19 +0000 | [diff] [blame] | 25 | import 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 | */ |
kevinb9n | a99dca7 | 2007-02-11 04:48:57 +0000 | [diff] [blame] | 33 | @Target({ METHOD, CONSTRUCTOR, FIELD, PARAMETER }) |
crazyboblee | 66b415a | 2006-08-25 02:01:19 +0000 | [diff] [blame] | 34 | @Retention(RUNTIME) |
| 35 | public @interface Inject { |
| 36 | |
| 37 | /** |
crazyboblee | 6ab7e1f | 2006-12-02 00:20:36 +0000 | [diff] [blame] | 38 | * Dependency name. Defaults to {@link Key#DEFAULT_NAME}. |
crazyboblee | 66b415a | 2006-08-25 02:01:19 +0000 | [diff] [blame] | 39 | */ |
crazyboblee | 6ab7e1f | 2006-12-02 00:20:36 +0000 | [diff] [blame] | 40 | String value() default Key.DEFAULT_NAME; |
crazyboblee | 66b415a | 2006-08-25 02:01:19 +0000 | [diff] [blame] | 41 | |
| 42 | /** |
kevinb9n | a99dca7 | 2007-02-11 04:48:57 +0000 | [diff] [blame] | 43 | * Whether or not injection is required. Applicable only to methods and fields |
| 44 | * (not constructors or parameters). |
crazyboblee | 66b415a | 2006-08-25 02:01:19 +0000 | [diff] [blame] | 45 | */ |
| 46 | boolean required() default true; |
| 47 | } |