added support for "isXXX"

is text ? image ? link ? video ?
This commit is contained in:
Louis Vallat 2019-04-23 12:15:51 +02:00
parent 97624621ae
commit 1a7e8c88cc
5 changed files with 115 additions and 4 deletions

View File

@ -194,4 +194,29 @@ public abstract class RedditPost {
public String getPostId() { public String getPostId() {
return postId; return postId;
} }
/**
* Is this post an image?
* @return if the post is an image.
*/
public abstract boolean isImage();
/**
* Is this post a text?
* @return if the post is a text.
*/
public abstract boolean isText();
/**
* Is this post a video?
* @return if the post is a video.
*/
public abstract boolean isVideo();
/**
* Is this post a link?
* @return if the post is a link.
*/
public abstract boolean isLink();
} }

View File

@ -22,8 +22,29 @@ package twitter_techsupportgore_bot.reddit_handler;
*/ */
public class RedditPostImage extends RedditPost { public class RedditPostImage extends RedditPost {
public RedditPostImage(String id, String title, boolean quarantine, double score, String postHint, boolean crosspostable, boolean over18, String author, String permalink, boolean spoiler) { public RedditPostImage(String id, String title, boolean quarantine,
double score, String postHint, boolean crosspostable,
boolean over18, String author, String permalink, boolean spoiler) {
super(id, title, quarantine, score, postHint, crosspostable, over18, author, permalink, spoiler); super(id, title, quarantine, score, postHint, crosspostable, over18, author, permalink, spoiler);
} }
@Override
public boolean isImage() {
return true;
}
@Override
public boolean isText() {
return false;
}
@Override
public boolean isVideo() {
return false;
}
@Override
public boolean isLink() {
return false;
}
} }

View File

@ -22,8 +22,30 @@ package twitter_techsupportgore_bot.reddit_handler;
*/ */
public class RedditPostLink extends RedditPost { public class RedditPostLink extends RedditPost {
public RedditPostLink(String id, String title, boolean quarantine, double score, String postHint, boolean crosspostable, boolean over18, String author, String permalink, boolean spoiler) { public RedditPostLink(String id, String title, boolean quarantine,
double score, String postHint, boolean crosspostable,
boolean over18, String author, String permalink, boolean spoiler) {
super(id, title, quarantine, score, postHint, crosspostable, over18, author, permalink, spoiler); super(id, title, quarantine, score, postHint, crosspostable, over18, author, permalink, spoiler);
} }
@Override
public boolean isImage() {
return false;
}
@Override
public boolean isText() {
return false;
}
@Override
public boolean isVideo() {
return false;
}
@Override
public boolean isLink() {
return true;
}
} }

View File

@ -22,8 +22,29 @@ package twitter_techsupportgore_bot.reddit_handler;
*/ */
public class RedditPostText extends RedditPost { public class RedditPostText extends RedditPost {
public RedditPostText(String id, String title, boolean quarantine, double score, String postHint, boolean crosspostable, boolean over18, String author, String permalink, boolean spoiler) { public RedditPostText(String id, String title, boolean quarantine,
double score, String postHint, boolean crosspostable,
boolean over18, String author, String permalink, boolean spoiler) {
super(id, title, quarantine, score, postHint, crosspostable, over18, author, permalink, spoiler); super(id, title, quarantine, score, postHint, crosspostable, over18, author, permalink, spoiler);
} }
@Override
public boolean isImage() {
return false;
}
@Override
public boolean isText() {
return true;
}
@Override
public boolean isVideo() {
return false;
}
@Override
public boolean isLink() {
return false;
}
} }

View File

@ -22,8 +22,30 @@ package twitter_techsupportgore_bot.reddit_handler;
*/ */
public class RedditPostVideo extends RedditPost{ public class RedditPostVideo extends RedditPost{
public RedditPostVideo(String id, String title, boolean quarantine, double score, String postHint, boolean crosspostable, boolean over18, String author, String permalink, boolean spoiler) { public RedditPostVideo(String id, String title, boolean quarantine,
double score, String postHint, boolean crosspostable,
boolean over18, String author, String permalink, boolean spoiler) {
super(id, title, quarantine, score, postHint, crosspostable, over18, author, permalink, spoiler); super(id, title, quarantine, score, postHint, crosspostable, over18, author, permalink, spoiler);
} }
@Override
public boolean isImage() {
return false;
}
@Override
public boolean isText() {
return false;
}
@Override
public boolean isVideo() {
return true;
}
@Override
public boolean isLink() {
return false;
}
} }