// Path: lifecyclebinder-processor/src/main/java/it/codingjam/lifecyclebinder/EventMethodDefinition.java
// public class EventMethodDefinition {
//     public static final EnumMap<LifeCycleEvent, EventMethodDefinition> EVENTS = createMap();
// 
//     private static EnumMap<LifeCycleEvent, EventMethodDefinition> createMap() {
//         EnumMap<LifeCycleEvent, EventMethodDefinition> ret = new EnumMap<>(LifeCycleEvent.class);
// 
//         ClassName bundle = bestGuess("android.os.Bundle");
//         ClassName intent = bestGuess("android.content.Intent");
//         ClassName menu = bestGuess("android.view.Menu");
//         ClassName menuInflater = bestGuess("android.view.MenuInflater");
//         ClassName menuItem = bestGuess("android.view.MenuItem");
// 
//         ret.put(CREATE, voidMethod("onCreate", bundle, intent, bundle));
//         ret.put(START, voidMethod("onStart"));
//         ret.put(RESUME, voidMethod("onResume"));
//         ret.put(HAS_OPTION_MENU, booleanMethod("hasOptionsMenu"));
//         ret.put(CREATE_OPTION_MENU, voidMethod("onCreateOptionsMenu", menu, menuInflater));
//         ret.put(OPTION_ITEM_SELECTED, booleanMethod("onOptionsItemSelected", menuItem));
//         ret.put(PAUSE, voidMethod("onPause"));
//         ret.put(STOP, voidMethod("onStop"));
//         ret.put(SAVE_INSTANCE_STATE, voidMethod("onSaveInstanceState", bundle));
//         ret.put(DESTROY, voidMethod("onDestroy", BOOLEAN));
//         ret.put(ACTIVITY_RESULT, voidMethod("onActivityResult", INT, INT, intent));
//         ret.put(VIEW_CREATED, voidMethod("onViewCreated", bundle));
//         ret.put(DESTROY_VIEW, voidMethod("onDestroyView"));
// 
//         return ret;
//     }
// 
//     public final String name;
// 
//     public final TypeName returnType;
// 
//     public final TypeName[] parameterTypes;
// 
//     private EventMethodDefinition(String name, TypeName returnType, TypeName... parameterTypes) {
//         this.name = name;
//         this.parameterTypes = parameterTypes;
//         this.returnType = returnType;
//     }
// 
//     private static EventMethodDefinition voidMethod(String name, TypeName... parameterTypes) {
//         return new EventMethodDefinition(name, null, parameterTypes);
//     }
// 
//     private static EventMethodDefinition booleanMethod(String name, TypeName... parameterTypes) {
//         return new EventMethodDefinition(name, ClassName.BOOLEAN, parameterTypes);
//     }
// }
// 
// Path: lifecyclebinder-api/src/main/java/it/codingjam/lifecyclebinder/LifeCycleEvent.java
// public enum LifeCycleEvent {
//     CREATE, START, RESUME, PAUSE, STOP, DESTROY, SAVE_INSTANCE_STATE, ACTIVITY_RESULT, HAS_OPTION_MENU, CREATE_OPTION_MENU, OPTION_ITEM_SELECTED, VIEW_CREATED, DESTROY_VIEW;
// }


import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.TypeName;
import it.codingjam.lifecyclebinder.BindEvent;
import it.codingjam.lifecyclebinder.EventMethodDefinition;
import it.codingjam.lifecyclebinder.LifeCycleEvent;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.VariableElement;
package it.codingjam.lifecyclebinder.data;


public class EventMethodElement {
    private static final ClassName EVENT_CLASS_NAME = ClassName.get(LifeCycleEvent.class);
    public final ExecutableElement element;
    public final LifeCycleEvent[] events;
    public final TypeName viewTypeName;

    public EventMethodElement(ExecutableElement element) {
        this.element = element;
        events = element.getAnnotation(BindEvent.class).value();
        viewTypeName = retrieveViewTypeName(element);
    }

    private TypeName retrieveViewTypeName(ExecutableElement element) {
        for (LifeCycleEvent lifeCycleEvent : events) {
// Path: lifecyclebinder-processor/src/main/java/it/codingjam/lifecyclebinder/EventMethodDefinition.java
// public class EventMethodDefinition {
//     public static final EnumMap<LifeCycleEvent, EventMethodDefinition> EVENTS = createMap();
// 
//     private static EnumMap<LifeCycleEvent, EventMethodDefinition> createMap() {
//         EnumMap<LifeCycleEvent, EventMethodDefinition> ret = new EnumMap<>(LifeCycleEvent.class);
// 
//         ClassName bundle = bestGuess("android.os.Bundle");
//         ClassName intent = bestGuess("android.content.Intent");
//         ClassName menu = bestGuess("android.view.Menu");
//         ClassName menuInflater = bestGuess("android.view.MenuInflater");
//         ClassName menuItem = bestGuess("android.view.MenuItem");
// 
//         ret.put(CREATE, voidMethod("onCreate", bundle, intent, bundle));
//         ret.put(START, voidMethod("onStart"));
//         ret.put(RESUME, voidMethod("onResume"));
//         ret.put(HAS_OPTION_MENU, booleanMethod("hasOptionsMenu"));
//         ret.put(CREATE_OPTION_MENU, voidMethod("onCreateOptionsMenu", menu, menuInflater));
//         ret.put(OPTION_ITEM_SELECTED, booleanMethod("onOptionsItemSelected", menuItem));
//         ret.put(PAUSE, voidMethod("onPause"));
//         ret.put(STOP, voidMethod("onStop"));
//         ret.put(SAVE_INSTANCE_STATE, voidMethod("onSaveInstanceState", bundle));
//         ret.put(DESTROY, voidMethod("onDestroy", BOOLEAN));
//         ret.put(ACTIVITY_RESULT, voidMethod("onActivityResult", INT, INT, intent));
//         ret.put(VIEW_CREATED, voidMethod("onViewCreated", bundle));
//         ret.put(DESTROY_VIEW, voidMethod("onDestroyView"));
// 
//         return ret;
//     }
// 
//     public final String name;
// 
//     public final TypeName returnType;
// 
//     public final TypeName[] parameterTypes;
// 
//     private EventMethodDefinition(String name, TypeName returnType, TypeName... parameterTypes) {
//         this.name = name;
//         this.parameterTypes = parameterTypes;
//         this.returnType = returnType;
//     }
// 
//     private static EventMethodDefinition voidMethod(String name, TypeName... parameterTypes) {
//         return new EventMethodDefinition(name, null, parameterTypes);
//     }
// 
//     private static EventMethodDefinition booleanMethod(String name, TypeName... parameterTypes) {
//         return new EventMethodDefinition(name, ClassName.BOOLEAN, parameterTypes);
//     }
// }
// 
// Path: lifecyclebinder-api/src/main/java/it/codingjam/lifecyclebinder/LifeCycleEvent.java
// public enum LifeCycleEvent {
//     CREATE, START, RESUME, PAUSE, STOP, DESTROY, SAVE_INSTANCE_STATE, ACTIVITY_RESULT, HAS_OPTION_MENU, CREATE_OPTION_MENU, OPTION_ITEM_SELECTED, VIEW_CREATED, DESTROY_VIEW;
// }


// Path: lifecyclebinder-processor/src/main/java/it/codingjam/lifecyclebinder/data/EventMethodElement.java
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.TypeName;
import it.codingjam.lifecyclebinder.BindEvent;
import it.codingjam.lifecyclebinder.EventMethodDefinition;
import it.codingjam.lifecyclebinder.LifeCycleEvent;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.VariableElement;

package it.codingjam.lifecyclebinder.data;


public class EventMethodElement {
    private static final ClassName EVENT_CLASS_NAME = ClassName.get(LifeCycleEvent.class);
    public final ExecutableElement element;
    public final LifeCycleEvent[] events;
    public final TypeName viewTypeName;

    public EventMethodElement(ExecutableElement element) {
        this.element = element;
        events = element.getAnnotation(BindEvent.class).value();
        viewTypeName = retrieveViewTypeName(element);
    }

    private TypeName retrieveViewTypeName(ExecutableElement element) {
        for (LifeCycleEvent lifeCycleEvent : events) {
            EventMethodDefinition definition = EventMethodDefinition.EVENTS.get(lifeCycleEvent);