public int typeExchange ( Element element ) { TypeMirror typeMirror = element . asType ( ) ; // Primitive if ( typeMirror . getKind ( ) . isPrimitive ( ) ) { return element . asType ( ) . getKind ( ) . ordinal ( ) ; } switch ( typeMirror . toString ( ) ) { case BYTE : return TypeKind . BYTE . ordinal ( ) ; case SHORT : return TypeKind . SHORT . ordinal ( ) ; case INTEGER : return TypeKind . INT . ordinal ( ) ; case LONG : return TypeKind . LONG . ordinal ( ) ; case FLOAT : return TypeKind . FLOAT . ordinal ( ) ; case DOUBEL : return TypeKind . DOUBLE . ordinal ( ) ; case BOOLEAN : return TypeKind . BOOLEAN . ordinal ( ) ; case CHAR : return TypeKind . CHAR . ordinal ( ) ; case STRING : return TypeKind . STRING . ordinal ( ) ; default : // Other side, maybe the PARCELABLE or SERIALIZABLE or OBJECT. if ( types . isSubtype ( typeMirror , parcelableType ) ) { // PARCELABLE return TypeKind . PARCELABLE . ordinal ( ) ; } else if ( types . isSubtype ( typeMirror , serializableType ) ) { // SERIALIZABLE return TypeKind . SERIALIZABLE . ordinal ( ) ; } else { return TypeKind . OBJECT . ordinal ( ) ; } } }
Diagnostics out the true java type