// Path: kratos-compiler/src/main/java/kratos/compiler/binding/KBindingGeneric.java
// public interface KBindingGeneric {
//     public void addGenericCode(MethodSpec.Builder result, String key);
// 
//     public String getMethodName();
// 
//     public String[] getParameterTypes();
// }


import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.ParameterizedTypeName;
import com.squareup.javapoet.TypeSpec;
import com.squareup.javapoet.TypeVariableName;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.lang.model.element.Modifier;
import kratos.compiler.binding.KBindingGeneric;
import static javax.lang.model.element.Modifier.FINAL;
import static javax.lang.model.element.Modifier.PUBLIC;

        result.addMethod(createBindMethod());

        return JavaFile.builder(classPackage, result.build())
                .addFileComment("Generated code from Kratos. Do not modify!")
                .build();
    }

    private MethodSpec createBindMethod() {
        MethodSpec.Builder result = MethodSpec.methodBuilder("bind")
                .addAnnotation(Override.class)
                .addModifiers(PUBLIC)
                .addParameter(TypeVariableName.get("T"), "target", FINAL)
                .addParameter(KFINDER, "finder", FINAL);
        if (parentViewBinder != null) {
            result.addStatement("super.bind(target, finder)");
        }
        if (layoutId != null) {
            if (!isLibrary)
                result.addStatement("target.setLayoutId($L)", Integer.parseInt(layoutId));
            else
                result.addStatement("target.setLayoutId($T.layout.$L)", resClass, layoutId);
            result.addStatement("target.init()");
        }
        //if (!updateKStringBindingMap.isEmpty()) {
        //    for (Map.Entry<String, UpdateKStringBinding> entry : updateKStringBindingMap.entrySet()) {
        //        addKStringUpdateBindings(result, entry);
        //    }
        //}
        if (!map.isEmpty()) {
// Path: kratos-compiler/src/main/java/kratos/compiler/binding/KBindingGeneric.java
// public interface KBindingGeneric {
//     public void addGenericCode(MethodSpec.Builder result, String key);
// 
//     public String getMethodName();
// 
//     public String[] getParameterTypes();
// }


// Path: kratos-compiler/src/main/java/kratos/compiler/BindingClass.java
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.ParameterizedTypeName;
import com.squareup.javapoet.TypeSpec;
import com.squareup.javapoet.TypeVariableName;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.lang.model.element.Modifier;
import kratos.compiler.binding.KBindingGeneric;
import static javax.lang.model.element.Modifier.FINAL;
import static javax.lang.model.element.Modifier.PUBLIC;


        result.addMethod(createBindMethod());

        return JavaFile.builder(classPackage, result.build())
                .addFileComment("Generated code from Kratos. Do not modify!")
                .build();
    }

    private MethodSpec createBindMethod() {
        MethodSpec.Builder result = MethodSpec.methodBuilder("bind")
                .addAnnotation(Override.class)
                .addModifiers(PUBLIC)
                .addParameter(TypeVariableName.get("T"), "target", FINAL)
                .addParameter(KFINDER, "finder", FINAL);
        if (parentViewBinder != null) {
            result.addStatement("super.bind(target, finder)");
        }
        if (layoutId != null) {
            if (!isLibrary)
                result.addStatement("target.setLayoutId($L)", Integer.parseInt(layoutId));
            else
                result.addStatement("target.setLayoutId($T.layout.$L)", resClass, layoutId);
            result.addStatement("target.init()");
        }
        //if (!updateKStringBindingMap.isEmpty()) {
        //    for (Map.Entry<String, UpdateKStringBinding> entry : updateKStringBindingMap.entrySet()) {
        //        addKStringUpdateBindings(result, entry);
        //    }
        //}
        if (!map.isEmpty()) {
            for (Map<String, KBindingGeneric> generics : map.values()) {