package com.gh.gamecenter.room.converter;

import com.gh.gamecenter.core.utils.GsonUtils;
import com.gh.gamecenter.qa.entity.ImageInfo;
import com.google.gson.reflect.TypeToken;

import java.lang.reflect.Type;
import java.util.List;

import androidx.room.TypeConverter;

public class ImageInfoConverter {
    @TypeConverter
    public static String toListString(List<ImageInfo> data) {
        return GsonUtils.toJson(data);
    }

    @TypeConverter
    public static List<ImageInfo> toList(String token) {
        Type type = new TypeToken<List<ImageInfo>>() {
        }.getType();
        return GsonUtils.getGson().fromJson(token, type);
    }
}
