Skip to content

Instantly share code, notes, and snippets.

@hitherejoe
Created August 27, 2015 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hitherejoe/d32ce9dd804f73d7f355 to your computer and use it in GitHub Desktop.
Save hitherejoe/d32ce9dd804f73d7f355 to your computer and use it in GitHub Desktop.
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