TagListのConverterを実装した

This commit is contained in:
ろむねこ 2023-12-14 11:36:09 +09:00
parent 8196e9afcb
commit 957ad6aacb
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168

View File

@ -0,0 +1,19 @@
package one.nem.lacerta.source.database.common;
import androidx.room.TypeConverter;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class TagListConverter {
@TypeConverter
public static String fromList(List<String> list) {
return list == null ? null : String.join(",", list);
}
@TypeConverter
public static List<String> fromString(String value) {
return value == null ? Collections.emptyList() : Arrays.asList(value.split(","));
}
}