Commit bda4dd3e authored by Sajal Narang's avatar Sajal Narang

Fix type conversion bug

parent 933a0165
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</value> </value>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8 (1)" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">
......
...@@ -6,7 +6,9 @@ import com.google.gson.Gson; ...@@ -6,7 +6,9 @@ import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type; import java.lang.reflect.Type;
import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -63,4 +65,16 @@ public class Converters { ...@@ -63,4 +65,16 @@ public class Converters {
String json = gson.toJson(list); String json = gson.toJson(list);
return json; return json;
} }
@TypeConverter
public static Timestamp timestampfromString(String value) {
return new Gson().fromJson(value, Timestamp.class);
}
@TypeConverter
public static String stringfromTimestamp(Timestamp timestamp) {
Gson gson = new Gson();
String json = gson.toJson(timestamp);
return json;
}
} }
\ No newline at end of file
...@@ -15,7 +15,6 @@ public class Event { ...@@ -15,7 +15,6 @@ public class Event {
@PrimaryKey(autoGenerate = true) @PrimaryKey(autoGenerate = true)
int db_id; int db_id;
@ColumnInfo(name = "id") @ColumnInfo(name = "id")
@SerializedName("id") @SerializedName("id")
String eventID; String eventID;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment