001package sting;
002
003import java.lang.annotation.Documented;
004import java.lang.annotation.ElementType;
005import java.lang.annotation.Retention;
006import java.lang.annotation.RetentionPolicy;
007import java.lang.annotation.Target;
008import javax.annotation.Nonnull;
009
010/**
011 * Qualify a service with a name.
012 *
013 * <p>Sting actively processes this annotation on {@link Injectable} types, {@link Injectable}
014 * constructor parameters, {@link Fragment} provider methods, {@link Fragment} provider method
015 * parameters, and {@link Injector} output methods.</p>
016 *
017 * <p>Sting also tolerates this annotation for framework integration on {@link InjectorFragment}
018 * methods, on constructor parameters whose enclosing type is annotated with an annotation
019 * meta-annotated by {@link ActAsStingConsumer}, and on types annotated with an annotation
020 * meta-annotated by {@link ActAsStingProvider}. Types annotated with annotations meta-annotated
021 * by {@link ActAsStingComponent} receive both validation allowances.</p>
022 */
023@Documented
024@Retention( RetentionPolicy.RUNTIME )
025@Target( { ElementType.PARAMETER, ElementType.METHOD, ElementType.TYPE } )
026public @interface Named
027{
028  /**
029   * An opaque string that qualifies the service.
030   * The string is user-supplied and used to distinguish two different services with the same type
031   * but different semantics.
032   *
033   * @return an opaque qualifier string or name.
034   */
035  @Nonnull
036  String value();
037}