LocationConvert.java
798 Bytes
package com.lijinji.part.bean.convert;
import com.google.gson.Gson;
import com.lijinji.part.bean.LineBean;
import com.lijinji.part.bean.LocationBean;
import org.greenrobot.greendao.converter.PropertyConverter;
public class LocationConvert implements PropertyConverter<LocationBean, String> {
@Override
public LocationBean convertToEntityProperty(String databaseValue) {
if (databaseValue == null) {
return null;
}
LocationBean locationBean = new Gson().fromJson(databaseValue, LocationBean.class);
return locationBean;
}
@Override
public String convertToDatabaseValue(LocationBean entityProperty) {
if (entityProperty == null) {
return null;
}
return new Gson().toJson(entityProperty);
}
}