mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
TagListのConverterを実装した
This commit is contained in:
parent
8196e9afcb
commit
957ad6aacb
|
@ -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(","));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user