// Path: arouter-annotation/src/main/java/com/alibaba/android/arouter/facade/enums/TypeKind.java
// public enum TypeKind {
//     // Base type
//     BOOLEAN,
//     BYTE,
//     SHORT,
//     INT,
//     LONG,
//     CHAR,
//     FLOAT,
//     DOUBLE,
// 
//     // Other type
//     STRING,
//     SERIALIZABLE,
//     PARCELABLE,
//     OBJECT;
// }
// 
// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/Consts.java
// public static final String BOOLEAN = LANG + ".Boolean";
// 
// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/Consts.java
// public static final String BYTE = LANG + ".Byte";
// 
// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/Consts.java
// public static final String DOUBEL = LANG + ".Double";
// 
// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/Consts.java
// public static final String FLOAT = LANG + ".Float";
// 
// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/Consts.java
// public static final String INTEGER = LANG + ".Integer";
// 
// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/Consts.java
// public static final String LONG = LANG + ".Long";
// 
// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/Consts.java
// public static final String PARCELABLE = "android.os.Parcelable";
// 
// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/Consts.java
// public static final String SERIALIZABLE = "java.io.Serializable";
// 
// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/Consts.java
// public static final String SHORT = LANG + ".Short";
// 
// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/Consts.java
// public static final String STRING = LANG + ".String";
// 
// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/Consts.java
// public static final String CHAR = LANG + ".Character";


import com.alibaba.android.arouter.facade.enums.TypeKind;
import javax.lang.model.element.Element;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
import static com.alibaba.android.arouter.compiler.utils.Consts.BOOLEAN;
import static com.alibaba.android.arouter.compiler.utils.Consts.BYTE;
import static com.alibaba.android.arouter.compiler.utils.Consts.DOUBEL;
import static com.alibaba.android.arouter.compiler.utils.Consts.FLOAT;
import static com.alibaba.android.arouter.compiler.utils.Consts.INTEGER;
import static com.alibaba.android.arouter.compiler.utils.Consts.LONG;
import static com.alibaba.android.arouter.compiler.utils.Consts.PARCELABLE;
import static com.alibaba.android.arouter.compiler.utils.Consts.SERIALIZABLE;
import static com.alibaba.android.arouter.compiler.utils.Consts.SHORT;
import static com.alibaba.android.arouter.compiler.utils.Consts.STRING;
import static com.alibaba.android.arouter.compiler.utils.Consts.CHAR;
package com.alibaba.android.arouter.compiler.utils;




/**
 * Utils for type exchange
 *
 * @author zhilong <a href="mailto:zhilong.lzl@alibaba-inc.com">Contact me.</a>
 * @version 1.0
 * @since 2017/2/21 下午1:06
 */
public class TypeUtils {

    private Types types;
    private TypeMirror parcelableType;
    private TypeMirror serializableType;

    public TypeUtils(Types types, Elements elements) {
        this.types = types;

        parcelableType = elements.getTypeElement(PARCELABLE).asType();
        serializableType = elements.getTypeElement(SERIALIZABLE).asType();
    }

    /**
     * Diagnostics out the true java type
     *
     * @param element Raw type
     * @return Type class of java
     */
    public int typeExchange(Element element) {
        TypeMirror typeMirror = element.asType();

        // Primitive
        if (typeMirror.getKind().isPrimitive()) {
            return element.asType().getKind().ordinal();
        }

// Path: arouter-annotation/src/main/java/com/alibaba/android/arouter/facade/enums/TypeKind.java
// public enum TypeKind {
//     // Base type
//     BOOLEAN,
//     BYTE,
//     SHORT,
//     INT,
//     LONG,
//     CHAR,
//     FLOAT,
//     DOUBLE,
// 
//     // Other type
//     STRING,
//     SERIALIZABLE,
//     PARCELABLE,
//     OBJECT;
// }
// 
// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/Consts.java
// public static final String BOOLEAN = LANG + ".Boolean";
// 
// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/Consts.java
// public static final String BYTE = LANG + ".Byte";
// 
// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/Consts.java
// public static final String DOUBEL = LANG + ".Double";
// 
// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/Consts.java
// public static final String FLOAT = LANG + ".Float";
// 
// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/Consts.java
// public static final String INTEGER = LANG + ".Integer";
// 
// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/Consts.java
// public static final String LONG = LANG + ".Long";
// 
// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/Consts.java
// public static final String PARCELABLE = "android.os.Parcelable";
// 
// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/Consts.java
// public static final String SERIALIZABLE = "java.io.Serializable";
// 
// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/Consts.java
// public static final String SHORT = LANG + ".Short";
// 
// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/Consts.java
// public static final String STRING = LANG + ".String";
// 
// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/Consts.java
// public static final String CHAR = LANG + ".Character";


// Path: arouter-compiler/src/main/java/com/alibaba/android/arouter/compiler/utils/TypeUtils.java
import com.alibaba.android.arouter.facade.enums.TypeKind;
import javax.lang.model.element.Element;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
import static com.alibaba.android.arouter.compiler.utils.Consts.BOOLEAN;
import static com.alibaba.android.arouter.compiler.utils.Consts.BYTE;
import static com.alibaba.android.arouter.compiler.utils.Consts.DOUBEL;
import static com.alibaba.android.arouter.compiler.utils.Consts.FLOAT;
import static com.alibaba.android.arouter.compiler.utils.Consts.INTEGER;
import static com.alibaba.android.arouter.compiler.utils.Consts.LONG;
import static com.alibaba.android.arouter.compiler.utils.Consts.PARCELABLE;
import static com.alibaba.android.arouter.compiler.utils.Consts.SERIALIZABLE;
import static com.alibaba.android.arouter.compiler.utils.Consts.SHORT;
import static com.alibaba.android.arouter.compiler.utils.Consts.STRING;
import static com.alibaba.android.arouter.compiler.utils.Consts.CHAR;

package com.alibaba.android.arouter.compiler.utils;




/**
 * Utils for type exchange
 *
 * @author zhilong <a href="mailto:zhilong.lzl@alibaba-inc.com">Contact me.</a>
 * @version 1.0
 * @since 2017/2/21 下午1:06
 */
public class TypeUtils {

    private Types types;
    private TypeMirror parcelableType;
    private TypeMirror serializableType;

    public TypeUtils(Types types, Elements elements) {
        this.types = types;

        parcelableType = elements.getTypeElement(PARCELABLE).asType();
        serializableType = elements.getTypeElement(SERIALIZABLE).asType();
    }

    /**
     * Diagnostics out the true java type
     *
     * @param element Raw type
     * @return Type class of java
     */
    public int typeExchange(Element element) {
        TypeMirror typeMirror = element.asType();

        // Primitive
        if (typeMirror.getKind().isPrimitive()) {
            return element.asType().getKind().ordinal();
        }

        switch (typeMirror.toString()) {