Skip to content

Commit

Permalink
Fix Long and Float Type error
Browse files Browse the repository at this point in the history
  • Loading branch information
lwj1994 committed Mar 10, 2022
1 parent a1941cb commit 9df3088
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/com/lwjlol/ormkv/demo/UserModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ data class UserModel(
val id: Long,
@ColumnInfo(defValue = "false")
val isMan: Boolean,
@ColumnInfo(defValue = "0F", enableReset = false)
@ColumnInfo(defValue = "1231", enableReset = false)
val temperature: Float

) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ class KspOrmkvProcessor(
}
"kotlin.Float" -> {
defValue = defValue.ifEmpty { "0F" }
if (!defValue.endsWith('F')) {
defValue = "${defValue}F"
}
getName = "get(\"$keyName\", $defValue) as Float"
}
"kotlin.Int" -> {
Expand All @@ -145,6 +148,9 @@ class KspOrmkvProcessor(
}
"kotlin.Long" -> {
defValue = defValue.ifEmpty { "0L" }
if (!defValue.endsWith('L')) {
defValue = "${defValue}L"
}
getName = "get(\"$keyName\", $defValue) as Long"
}
"kotlin.Boolean" -> {
Expand Down Expand Up @@ -334,6 +340,6 @@ class KspOrmkvProvider : SymbolProcessorProvider {
}

private const val END_FIX = "Registry"
private const val LOG = true
private const val LOG = false
private const val HANDLER = "kvHandler"
private const val TAG = "KspOrmkv"

0 comments on commit 9df3088

Please sign in to comment.