Exemple #1
0
  @Before
  public void setup() {
    Bootstraps.inject(this);

    analysisContext = analysisContextFactory.buildContext();

    analysisContext
        .getInjectionNodeBuilders()
        .putType(
            B.class,
            variableInjectionBuilderFactory.buildVariableInjectionNodeBuilder(
                astClassFactory.getType(BImpl.class)));
  }
  public void processType(ASTType astType) {
    ImplementedBy annotation = astType.getAnnotation(ImplementedBy.class);

    if (annotation != null) {
      TypeMirror implementedClass =
          getTypeMirror(new ImplementedByClassTypeMirrorRunnable(annotation));

      ASTType implAstType = implementedClass.accept(astTypeBuilderVisitor, null);

      if (!implAstType.inheritsFrom(astType)) {
        throw new TransfuseAnalysisException(
            "ImplementedBy configuration points to a class that doesn't inherit from the given base class");
      }

      injectionNodeBuilders.putModuleConfig(
          astType, variableInjectionBuilderFactory.buildVariableInjectionNodeBuilder(implAstType));
    }
  }