// Path: annotations/src/main/java/com/mnayef/annotations/enums/ImageLibraries.java
// public enum ImageLibraries {
//     PICASSO, FRESCO
// }


import com.google.auto.service.AutoService;
import com.mnayef.annotations.Adapter;
import com.mnayef.annotations.Check;
import com.mnayef.annotations.Click;
import com.mnayef.annotations.Code;
import com.mnayef.annotations.Image;
import com.mnayef.annotations.Link;
import com.mnayef.annotations.LongClick;
import com.mnayef.annotations.Radio;
import com.mnayef.annotations.Text;
import com.mnayef.annotations.Video;
import com.mnayef.annotations.Visibility;
import com.mnayef.annotations.enums.ImageLibraries;
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.ParameterizedTypeName;
import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeSpec;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.Filer;
import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.Processor;
import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.Elements;
import javax.tools.Diagnostic;
            processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, entry.toString());
            findViewById(builder, entry.getKey(), entry.getValue());
        }
        viewHolder.addMethod(builder.build());
    }

    private void onBindViewHolder() {
        onBindViewHolder = MethodSpec.methodBuilder("onBindViewHolder")
                .addAnnotation(Override.class)
                .addModifiers(Modifier.PUBLIC)
                .addParameter(viewHolderClass, "holder", Modifier.FINAL)
                .addParameter(int.class, "position");
    }

    private void findViewById(MethodSpec.Builder builder, Element element, Annotation baseField) {
        FieldSpec fieldSpec;
        processingEnv.getMessager().printMessage(Diagnostic.Kind.WARNING, baseField + "");
        if (baseField instanceof Text) {
            Text field = (Text) baseField;
            fieldSpec = FieldSpec.builder(ClassesNames.TEXT_VIEW, element.getSimpleName().toString(), Modifier.PRIVATE).build();
            if (createdFields.get(String.valueOf(field.value())) == null) {
                FindViewUtil.findTextView(builder, fieldSpec.name, field);
                viewHolder.addField(fieldSpec);
                createdFields.put(String.valueOf(field.value()), fieldSpec.name);
                BindingUtil.bindTextView(onBindViewHolder, fieldSpec.name, fieldSpec.name);
            } else {
                BindingUtil.bindTextView(onBindViewHolder, createdFields.get(String.valueOf(field.value())), fieldSpec.name);
            }
        } else if (baseField instanceof Image) {
            Image field = (Image) baseField;
// Path: annotations/src/main/java/com/mnayef/annotations/enums/ImageLibraries.java
// public enum ImageLibraries {
//     PICASSO, FRESCO
// }


// Path: compiler/src/main/java/com/mnayef/compiler/AdapterProcessor.java
import com.google.auto.service.AutoService;
import com.mnayef.annotations.Adapter;
import com.mnayef.annotations.Check;
import com.mnayef.annotations.Click;
import com.mnayef.annotations.Code;
import com.mnayef.annotations.Image;
import com.mnayef.annotations.Link;
import com.mnayef.annotations.LongClick;
import com.mnayef.annotations.Radio;
import com.mnayef.annotations.Text;
import com.mnayef.annotations.Video;
import com.mnayef.annotations.Visibility;
import com.mnayef.annotations.enums.ImageLibraries;
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.ParameterizedTypeName;
import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeSpec;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.Filer;
import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.Processor;
import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.Elements;
import javax.tools.Diagnostic;

            processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, entry.toString());
            findViewById(builder, entry.getKey(), entry.getValue());
        }
        viewHolder.addMethod(builder.build());
    }

    private void onBindViewHolder() {
        onBindViewHolder = MethodSpec.methodBuilder("onBindViewHolder")
                .addAnnotation(Override.class)
                .addModifiers(Modifier.PUBLIC)
                .addParameter(viewHolderClass, "holder", Modifier.FINAL)
                .addParameter(int.class, "position");
    }

    private void findViewById(MethodSpec.Builder builder, Element element, Annotation baseField) {
        FieldSpec fieldSpec;
        processingEnv.getMessager().printMessage(Diagnostic.Kind.WARNING, baseField + "");
        if (baseField instanceof Text) {
            Text field = (Text) baseField;
            fieldSpec = FieldSpec.builder(ClassesNames.TEXT_VIEW, element.getSimpleName().toString(), Modifier.PRIVATE).build();
            if (createdFields.get(String.valueOf(field.value())) == null) {
                FindViewUtil.findTextView(builder, fieldSpec.name, field);
                viewHolder.addField(fieldSpec);
                createdFields.put(String.valueOf(field.value()), fieldSpec.name);
                BindingUtil.bindTextView(onBindViewHolder, fieldSpec.name, fieldSpec.name);
            } else {
                BindingUtil.bindTextView(onBindViewHolder, createdFields.get(String.valueOf(field.value())), fieldSpec.name);
            }
        } else if (baseField instanceof Image) {
            Image field = (Image) baseField;
            fieldSpec = FieldSpec.builder((field.library() == ImageLibraries.FRESCO ? ClassesNames.SIMPLE_DRAWEE_VIEW : ClassesNames.IMAGE_VIEW), element.getSimpleName().toString(), Modifier.PRIVATE).build();