Search in sources :

Example 1 with Builder

use of com.squareup.javapoet.ParameterSpec.Builder in project epoxy by airbnb.

the class ClassToGenerateInfo method buildParamList.

private List<ParameterSpec> buildParamList(List<? extends VariableElement> params) {
    List<ParameterSpec> result = new ArrayList<>();
    for (VariableElement param : params) {
        Builder builder = ParameterSpec.builder(TypeName.get(param.asType()), param.getSimpleName().toString());
        for (AnnotationMirror annotation : param.getAnnotationMirrors()) {
            builder.addAnnotation(AnnotationSpec.get(annotation));
        }
        result.add(builder.build());
    }
    return result;
}
Also used : AnnotationMirror(javax.lang.model.element.AnnotationMirror) ParameterSpec(com.squareup.javapoet.ParameterSpec) Builder(com.squareup.javapoet.ParameterSpec.Builder) ArrayList(java.util.ArrayList) VariableElement(javax.lang.model.element.VariableElement)

Aggregations

ParameterSpec (com.squareup.javapoet.ParameterSpec)1 Builder (com.squareup.javapoet.ParameterSpec.Builder)1 ArrayList (java.util.ArrayList)1 AnnotationMirror (javax.lang.model.element.AnnotationMirror)1 VariableElement (javax.lang.model.element.VariableElement)1