Search in sources :

Example 1 with ConstructorInfo

use of com.airbnb.epoxy.ClassToGenerateInfo.ConstructorInfo in project epoxy by airbnb.

the class EpoxyProcessor method generateConstructors.

/** Include any constructors that are in the super class. */
private Iterable<MethodSpec> generateConstructors(ClassToGenerateInfo info) {
    List<MethodSpec> constructors = new ArrayList<>(info.getConstructors().size());
    for (ConstructorInfo constructorInfo : info.getConstructors()) {
        Builder builder = MethodSpec.constructorBuilder().addModifiers(constructorInfo.modifiers).addParameters(constructorInfo.params).varargs(constructorInfo.varargs);
        StringBuilder statementBuilder = new StringBuilder("super(");
        generateParams(statementBuilder, constructorInfo.params);
        constructors.add(builder.addStatement(statementBuilder.toString()).build());
    }
    return constructors;
}
Also used : MethodSpec(com.squareup.javapoet.MethodSpec) Builder(com.squareup.javapoet.MethodSpec.Builder) ArrayList(java.util.ArrayList) ConstructorInfo(com.airbnb.epoxy.ClassToGenerateInfo.ConstructorInfo)

Aggregations

ConstructorInfo (com.airbnb.epoxy.ClassToGenerateInfo.ConstructorInfo)1 MethodSpec (com.squareup.javapoet.MethodSpec)1 Builder (com.squareup.javapoet.MethodSpec.Builder)1 ArrayList (java.util.ArrayList)1