This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Post { | |
public Long id; | |
public String by; | |
public Long time; | |
public ArrayList<Long> kids; | |
public String url; | |
public Long score; | |
public String title; | |
public String text; | |
@SerializedName("type") | |
public PostType postType; | |
public enum PostType { | |
@SerializedName("story") | |
STORY("story"), | |
@SerializedName("ask") | |
ASK("ask"), | |
@SerializedName("job") | |
JOB("job"); | |
private String string; | |
PostType(String string) { | |
this.string = string; | |
} | |
public static PostType fromString(String string) { | |
if (string != null) { | |
for (PostType postType : PostType.values()) { | |
if (string.equalsIgnoreCase(postType.string)) return postType; | |
} | |
} | |
return null; | |
} | |
} | |
public Post() { } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment