コード例 #1
0
ファイル: AnalyzerTest.java プロジェクト: rehos/transfuse
  @Before
  public void setup() {
    Bootstraps.inject(this);

    analysisContext = analysisContextFactory.buildContext();

    analysisContext
        .getInjectionNodeBuilders()
        .putType(
            B.class,
            variableInjectionBuilderFactory.buildVariableInjectionNodeBuilder(
                astClassFactory.getType(BImpl.class)));
  }
コード例 #2
0
  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));
    }
  }