} else {
return op;
}
}
Elements elements = processingEnv.getElementUtils();
TypeMirror type = arg.getElement().asType();
Types types = processingEnv.getTypeUtils();
String[] arrayListTypes = new String[] {
String.class.getName(), Integer.class.getName(), CharSequence.class.getName()
};
String[] arrayListOps =
new String[] { "StringArrayList", "IntegerArrayList", "CharSequenceArrayList" };
for (int i = 0; i < arrayListTypes.length; i++) {
TypeMirror tm = getArrayListType(arrayListTypes[i]);
if (types.isAssignable(type, tm)) {
return arrayListOps[i];
}
}
if (types.isAssignable(type,
getWildcardType(ArrayList.class.getName(), "android.os.Parcelable"))) {
return "ParcelableArrayList";
}
TypeMirror sparseParcelableArray =
getWildcardType("android.util.SparseArray", "android.os.Parcelable");
if (types.isAssignable(type, sparseParcelableArray)) {
return "SparseParcelableArray";
}
if (types.isAssignable(type, elements.getTypeElement(Serializable.class.getName()).asType())) {
return "Serializable";
}
if (types.isAssignable(type, elements.getTypeElement("android.os.Parcelable").asType())) {
return "Parcelable";
}
return null;
}