String extractGetIfList(TypeMirror typeMirror) {
String name = typeMirror.toString();
if (name.startsWith("java.util.List")) {
//check type
DeclaredType declaredType = typeMirror.accept(new SimpleTypeVisitor6<DeclaredType, String>() {
@Override
public DeclaredType visitDeclared(DeclaredType t, String s) {
return t;
}
}, name);
if (declaredType == null) {
return null;
}
List<? extends TypeMirror> typeArguments = declaredType.getTypeArguments();
if (typeArguments.isEmpty()) {
return null;
}
TypeMirror typeParameter = typeArguments.get(0);
switch (MirrorUtils.flattenArrayListType(environment, typeParameter)) {
case "java.lang.Integer":
return "args.getIntegerArrayList($S)";
case "java.lang.String":
return "args.getStringArrayList($S)";
case "java.lang.CharSequence":
return "args.getCharSequenceArrayList($S)";
case "android.os.Parcelable":
return "args.getParcelableArrayList($S)";
}
}
return null;
}
FragmentCreatorReadGenerator.java 文件源码
java
阅读 18
收藏 0
点赞 0
评论 0
项目:fragment-creator
作者:
评论列表
文章目录