예제 #1
0
  /** The access modifier is that of the sourceType. */
  @NonNull
  @Override
  public TypeSpec getTypeSpec() {
    TypeSpec.Builder result = TypeSpec.classBuilder(getTypeName());
    sourceType.applyAccessModifier(result);
    sourceType.applyTypeVariables(result);
    result.addJavadoc(createGeneratedAnnotation(processorClass).toString());
    result.addJavadoc("\n");
    result.addSuperinterface(getDecoratedTypeName());

    for (Element element : sourceType.getAllEnclosedElements()) {
      if (element.getKind() == ElementKind.METHOD) {
        MethodSpec method = createOverridingMethod((ExecutableElement) element).build();
        result.addMethod(method);
      }
    }

    return result.build();
  }
예제 #2
0
 private TypeName getDecoratedTypeName() {
   return TypeName.get(sourceType.asType());
 }
예제 #3
0
 @Override
 public TypeElement getSourceType() {
   return sourceType.getTypeElement();
 }