Skip to content

Commit

Permalink
日常提交:2022-08-08.
Browse files Browse the repository at this point in the history
  • Loading branch information
walgr committed Aug 8, 2022
1 parent d2c2b8b commit 03c1528
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions QuickBind/src/main/java/com/wpf/app/quickbind/QuickBind.kt
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,7 @@ object QuickBind {
) {
if (obj == null) return
try {
val fields: List<Field> = ReflectHelper.getFieldWithParent(obj)
for (field in fields) {
val annotations = field.annotations.toMutableList()
annotations.sortBy { plugins.keys.indexOf(it.annotationClass) }
annotations.forEach {
plugins[it.annotationClass]?.dealField(obj, null, field)
}
annotations.clear()
}

if (viewModel != null) {
val viewModelFields: List<Field> = ReflectHelper.getFieldWithParent(viewModel)
for (field in viewModelFields) {
Expand All @@ -167,6 +159,16 @@ object QuickBind {
}
annotations.clear()
}
} else {
val fields: List<Field> = ReflectHelper.getFieldWithParent(obj)
for (field in fields) {
val annotations = field.annotations.toMutableList()
annotations.sortBy { plugins.keys.indexOf(it.annotationClass) }
annotations.forEach {
plugins[it.annotationClass]?.dealField(obj, null, field)
}
annotations.clear()
}
}
} catch (e: Exception) {
e.printStackTrace()
Expand Down

0 comments on commit 03c1528

Please sign in to comment.