aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/ftbsc/lll/processor/containers/InjectorInfo.java
blob: d56d846f54fa240b4ece1b73ebde5e9f27364c15 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package ftbsc.lll.processor.containers;

import ftbsc.lll.processor.annotations.Injector;
import ftbsc.lll.processor.annotations.Target;
import ftbsc.lll.processor.ProcessorOptions;

import javax.lang.model.element.ExecutableElement;

/**
 * Container for information about a class that is to be generated.
 */
public class InjectorInfo {
   /**
    * The {@link ExecutableElement} corresponding to the injector method.
    */
   public final ExecutableElement injector;

   /**
    * The {@link ExecutableElement} corresponding to the target method stub.
    */
   public final ExecutableElement targetStub;

   /**
    * The reason for the injection.
    */
   public final String reason;

   /**
    * The {@link MethodContainer} corresponding to the target method.
    */
   public final MethodContainer target;

   /**
    * Public constructor.
    * @param injector the injector {@link ExecutableElement}
    * @param targetStub the target {@link ExecutableElement}
    * @param targetAnn the relevant {@link Target} annotation
    * @param options the {@link ProcessorOptions} to be used
    */
   public InjectorInfo(ExecutableElement injector, ExecutableElement targetStub, Target targetAnn, ProcessorOptions options) {
      this.injector = injector;
      this.targetStub = targetStub;
      this.reason = injector.getAnnotation(Injector.class).reason();
      this.target = MethodContainer.from(targetStub, targetAnn, null, options);
   }
}