| 1 | /* |
| 2 | * Copyright (C) 2009 The JSR-330 Expert Group |
| 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 javax.inject; |
| 18 | |
| 19 | import java.lang.annotation.Target; |
| 20 | import java.lang.annotation.Retention; |
| 21 | import java.lang.annotation.Documented; |
| 22 | import static java.lang.annotation.RetentionPolicy.RUNTIME; |
| 23 | import static java.lang.annotation.ElementType.ANNOTATION_TYPE; |
| 24 | |
| 25 | /** |
| 26 | * Identifies qualifier annotations. Anyone can define a new qualifier. A |
| 27 | * qualifier annotation: |
| 28 | * |
| 29 | * <ul> |
| 30 | * <li>is annotated with {@code @Qualifier}, {@code @Retention(RUNTIME)}, |
| 31 | * and typically {@code @Documented}.</li> |
| 32 | * <li>can have attributes.</li> |
| 33 | * <li>may be part of the public API, much like the dependency type, but |
| 34 | * unlike implementation types which needn't be part of the public |
| 35 | * API.</li> |
| 36 | * <li>may have restricted usage if annotated with {@code @Target}. While |
| 37 | * this specification covers applying qualifiers to fields and |
| 38 | * parameters only, some injector configurations might use qualifier |
| 39 | * annotations in other places (on methods or classes for example).</li> |
| 40 | * </ul> |
| 41 | * |
| 42 | * <p>For example: |
| 43 | * |
| 44 | * <pre> |
| 45 | * @java.lang.annotation.Documented |
| 46 | * @java.lang.annotation.Retention(RUNTIME) |
| 47 | * @javax.inject.Qualifier |
| 48 | * public @interface Leather { |
| 49 | * Color color() default Color.TAN; |
| 50 | * public enum Color { RED, BLACK, TAN } |
| 51 | * }</pre> |
| 52 | * |
| 53 | * @see javax.inject.Named @Named |
| 54 | */ |
| 55 | @Target(ANNOTATION_TYPE) |
| 56 | @Retention(RUNTIME) |
| 57 | @Documented |
| 58 | public @interface Qualifier {} |