String extractPutIfList(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.putIntegerArrayList($S,";
case "java.lang.String":
return "args.putStringArrayList($S,";
case "java.lang.CharSequence":
return "args.putCharSequenceArrayList($S,";
case "android.os.Parcelable":
return "args.putParcelableArrayList($S,";
}
}
return null;
}
FragmentCreatorBuilderGenerator.java 文件源码
java
阅读 18
收藏 0
点赞 0
评论 0
项目:fragment-creator
作者:
评论列表
文章目录