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 * Declare the types published by a component.
012 * This annotation is used to explicitly specify which types that a component can provide.
013 *
014 * <p>Sting actively processes this annotation on {@link Injectable} types and on provider methods
015 * contained within a type annotated by {@link Fragment}. When applied to a fragment provider method,
016 * the listed types become the complete set of published services for that binding.</p>
017 *
018 * <p>Sting also tolerates this annotation for framework integration on types annotated with an
019 * annotation meta-annotated by {@link ActAsStingProvider}. Types annotated with annotations
020 * meta-annotated by {@link ActAsStingComponent} receive the same validation allowance.</p>
021 *
022 * <p>{@link Typed} must not be applied to {@link Injector} output methods.</p>
023 *
024 * <p>If this annotation is applied to a class then the class must be able to be assigned to the
025 * types specified by this annotation. If the annotation is applied to a method then the return type
026 * of the method must be able to be assigned to the types specified by this annotation. The method
027 * return type is not implicitly published unless it is listed in {@link #value()}.</p>
028 */
029@Documented
030@Retention( RetentionPolicy.RUNTIME )
031@Target( { ElementType.TYPE, ElementType.METHOD } )
032public @interface Typed
033{
034  /**
035   * The types published by the component.
036   *
037   * @return the types published by the component.
038   */
039  @Nonnull
040  Class<?>[] value();
041}