Commit f8ba871f authored by yashkhem1's avatar yashkhem1

Updated TypeConverters

parent 77291a74
......@@ -103,4 +103,33 @@ public class Converters {
String json = gson.toJson(timestamp);
return json;
}
@TypeConverter
public static Body bodyfromString(String value){
Type listType = new TypeToken<Body>(){
}.getType();
return new Gson().fromJson(value,listType);
}
@TypeConverter
public static String stringfromBody(Body body){
Gson gson = new Gson();
String json = gson.toJson(body);
return json;
}
@TypeConverter
public static List<String> stringsfromString(String value){
Type listType = new TypeToken<List<String>>(){
}.getType();
return new Gson().fromJson(value,listType);
}
@TypeConverter
public static String stringfromStrings(List<String> list) {
Gson gson = new Gson();
String json = gson.toJson(list);
return json;
}
}
\ No newline at end of file
......@@ -55,7 +55,7 @@ public class User {
@SerializedName("ldap_id")
String userLDAPId;
public User(String userID, String userName, String userProfilePictureUrl, List<Event> userInterestedEvents, List<Event> userGoingEvents, String userEmail, String userRollNumber, String userContactNumber, String userAbout, List<Body> userFollowedBodies, List<String> userFollowedBodiesID, String userWebsiteURL, String userLDAPID) {
public User(String userID, String userName, String userProfilePictureUrl, List<Event> userInterestedEvents, List<Event> userGoingEvents, String userEmail, String userRollNumber, String userContactNumber, String userAbout, List<Body> userFollowedBodies, List<String> userFollowedBodiesID, String userWebsiteURL, String userLDAPId) {
this.userID = userID;
this.userName = userName;
this.userProfilePictureUrl = userProfilePictureUrl;
......@@ -68,7 +68,7 @@ public class User {
this.userFollowedBodies = userFollowedBodies;
this.userFollowedBodiesID = userFollowedBodiesID;
this.userWebsiteURL = userWebsiteURL;
this.userLDAPId = userLDAPID;
this.userLDAPId = userLDAPId;
}
public static User fromString(String json) {
......
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