@Target(value={TYPE,ANNOTATION_TYPE})
@Retention(value=RUNTIME)
public @interface AnnotateWith
This annotation is mainly intended to inject a Config instance to a DAO
implementation's constructor. Don't use Dao.config() with this annotation.
There are 2 ways to use this annotation:
annotate directly:
@Dao
@AnnotateWith(annotations = {
@Annotation(target = AnnotationTarget.CONSTRUCTOR, type = javax.inject.Inject.class),
@Annotation(target = AnnotationTarget.CONSTRUCTOR_PARAMETER, type = javax.inject.Named.class, elements = "\"config\"") })
public interface EmployeeDao {
...
}
annotate indirectly:
@AnnotateWith(annotations = {
@Annotation(target = AnnotationTarget.CONSTRUCTOR, type = javax.inject.Inject.class),
@Annotation(target = AnnotationTarget.CONSTRUCTOR_PARAMETER, type = javax.inject.Named.class, elements = "\"config\"") })
public @interface InjectConfig {
}
@Dao
@InjectConfig
public interface EmployeeDao {
...
}
| Modifier and Type | Required Element and Description |
|---|---|
Annotation[] |
annotations |
public abstract Annotation[] annotations
Annotation array.