mirror of
https://github.com/MewoLab/AquaDX.git
synced 2025-10-25 20:12:39 +00:00
[F] Fix integer list converter behavior on empty lists
This commit is contained in:
parent
56d0786702
commit
f97cb4a1bb
@ -6,5 +6,6 @@ import jakarta.persistence.Converter
|
||||
@Converter
|
||||
class IntegerListConverter : AttributeConverter<List<Int>, String> {
|
||||
override fun convertToDatabaseColumn(lst: List<Int>?) = lst?.joinToString(";") ?: ""
|
||||
override fun convertToEntityAttribute(str: String?) = str?.split(';')?.map { it.toInt() }?.toMutableList() ?: mutableListOf()
|
||||
override fun convertToEntityAttribute(str: String?) = if (str.isNullOrBlank()) mutableListOf() else
|
||||
str.split(';').map { it.toInt() }.toMutableList()
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user