@Override
  public boolean process(Set<? extends TypeElement> elements, RoundEnvironment env) {
    Map<TypeElement, BindingClass> targetClassMap = findAndParseTargets(env);

    for (Map.Entry<TypeElement, BindingClass> entry : targetClassMap.entrySet()) {
      TypeElement typeElement = entry.getKey();
      BindingClass bindingClass = entry.getValue();

      try {
        JavaFileObject jfo = filer.createSourceFile(bindingClass.getFqcn(), typeElement);
        Writer writer = jfo.openWriter();
        writer.write(bindingClass.brewJava());
        writer.flush();
        writer.close();
      } catch (IOException e) {
        error(
            typeElement,
            "Unable to write view binder for type %s: %s",
            typeElement,
            e.getMessage());
      }
    }

    return true;
  }
Пример #2
0
  @Override
  public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment env) {
    Map<TypeElement, BindingClass> targetClassMap = findAndParseTargets(env);

    for (Map.Entry<TypeElement, BindingClass> entry : targetClassMap.entrySet()) {
      TypeElement typeElement = entry.getKey();
      BindingClass BindingClass = entry.getValue();

      try {
        BindingClass.brewJava().writeTo(filer);
      } catch (IOException e) {
        error(
            typeElement,
            "Unable to write view binder for type %s: %s",
            typeElement,
            e.getMessage());
      }
    }

    return true;
  }