Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.github.jreddit.entity;
  
  import static com.github.jreddit.utils.restclient.JsonUtils.safeJsonToBoolean;
  import static com.github.jreddit.utils.restclient.JsonUtils.safeJsonToDouble;
  import static com.github.jreddit.utils.restclient.JsonUtils.safeJsonToLong;
  import static com.github.jreddit.utils.restclient.JsonUtils.safeJsonToString;
  
  
This class represents a vote on a link submission on Reddit.

Author(s):
Omer Elnour
Andrei Sfat
Raul Rene Lepsa
Jonny Krysh
Danny Tsegai
Simon Kassing
 
 public class Submission extends Thing {
 
     private RestClient restClient;

    
This is the user that will vote on a submission.
 
     private User user;
 
     private String url;
     private String permalink;
     private String author;
     private String title;
     private String subreddit;
     private String subredditId;
     private String thumbnail;
 
     private String selftext;
     private String selftextHTML;
     private String domain;
     private String bannedBy;
     private String approvedBy;
     
     private Long gilded;
     private Long commentCount;
     private Long reportCount;
     private Long score;
     private Long upVotes;
     private Long downVotes;
 
     private Double created;
     private Double createdUTC;
     private Boolean visited;
     private Boolean self;
     private Boolean saved;
     private Boolean edited;
     private Boolean stickied;
     private Boolean nsfw;
     private Boolean hidden;
     private Boolean clicked;
     
     // 
     //private String likes;
     //private String authorFlairCSSClass;
     //private String linkFlairCSSClass;
     //private String distinguished;
     
    

Returns:
the approvedBy
 
 	public String getApprovedBy() {
 		return ;
 	}

Parameters:
approvedBy the approvedBy to set
 
 	public void setApprovedBy(String approvedBy) {
 		this. = approvedBy;
 	}

Returns:
the hidden
 
 	public Boolean isHidden() {
 		return ;
 	}

Parameters:
hidden the hidden to set
 
 	public void setHidden(Boolean hidden) {
 		this. = hidden;
 	}

Returns:
the clicked
 
	public Boolean isClicked() {
		return ;
	}

Parameters:
clicked the clicked to set
	public void setClicked(Boolean clicked) {
		this. = clicked;
	}

Create a Submission from a JSONObject

Parameters:
obj The JSONObject to load Submission data from
    public Submission(JSONObject obj) {
    	super(safeJsonToString(obj.get("name")));
        try {
        	
            setURL(safeJsonToString(obj.get("url")));
            setPermalink(safeJsonToString(obj.get("permalink")));
            setAuthor(safeJsonToString(obj.get("author")));
            setTitle(safeJsonToString(obj.get("title")));
            setSubreddit(safeJsonToString(obj.get("subreddit")));
            setSubredditId(safeJsonToString(obj.get("subreddit_id")));
            setThumbnail(safeJsonToString(obj.get("thumbnail")));
            
            setSelftext(safeJsonToString(obj.get("selftext")));
            setSelftextHTML(safeJsonToString(obj.get("selftext_html")));
            setDomain(safeJsonToString(obj.get("domain")));
            setBannedBy(safeJsonToString(obj.get("banned_by")));
            setApprovedBy(safeJsonToString(obj.get("approved_by")));
            
            setGilded(safeJsonToLong(obj.get("gilded")));
            setCommentCount(safeJsonToLong(obj.get("num_comments")));
            setReportCount(safeJsonToLong(obj.get("num_reports")));
            setScore(safeJsonToLong(obj.get("score")));
            setUpVotes(safeJsonToLong(obj.get("ups")));
            setDownVotes(safeJsonToLong(obj.get("downs")));
            
            setCreated(safeJsonToDouble(obj.get("created")));
            setCreatedUTC(safeJsonToDouble(obj.get("created_utc")));
            
            setVisited(safeJsonToBoolean(obj.get("visited")));
            setSelf(safeJsonToBoolean(obj.get("self")));
            setSaved(safeJsonToBoolean(obj.get("saved")));
            setEdited(safeJsonToBoolean(obj.get("edited")));
            setStickied(safeJsonToBoolean(obj.get("stickied")));
            setNSFW(safeJsonToBoolean(obj.get("over_18")));
            setHidden(safeJsonToBoolean(obj.get("hidden")));
            setClicked(safeJsonToBoolean(obj.get("clicked")));
        } catch (Exception e) {
            ..println("Error creating Submission");
        }
         = new HttpRestClient();
    }
    // this is very stinky..
    public void setRestClient(RestClient restClient) {
        this. = restClient;
    }
    public void setUpVotes(Long upVotes) {
        this. = upVotes;
    }
    public void setScore(Long score) {
        this. = score;
    }
    public void setAuthor(String author) {
        this. = author;
    }
    public void setCreatedUTC(Double createdUTC) {
        this. = createdUTC;
    }
    public void setDownVotes(Long downVotes) {
        this. = downVotes;
    }
    public void setCommentCount(Long commentCount) {
        this. = commentCount;
    }
    public void setSubreddit(String subreddit) {
        this. = subreddit;
    }
    public void setTitle(String title) {
        this. = title;
    }
    public void setURL(String url) {
        this. = url;
    }
    public User getUser() {
        return ;
    }
    public void setUser(User user) {
        this. = user;
    }
    public String getURL() {
        return ;
    }
    public String getPermalink() {
        return ;
    }
    public void setPermalink(String permalink) {
        this. = permalink;
    }
    public RestClient getRestClient() {
        return ;
    }
    public Long getCommentCount() {
        return ;
    }
    public Long getUpVotes() {
        return ;
    }
    public Long getDownVotes() {
        return ;
    }
    public Long getScore() {
        return ;
    }
    public Double getCreatedUTC() {
        return ;
    }
    public String getAuthor() {
        return ;
    }
    public String getTitle() {
        return ;
    }
    public String getSubreddit() {
        return ;
    }
    
    

Returns:
the url
	public String getUrl() {
		return ;
	}

Parameters:
url the url to set
	public void setUrl(String url) {
		this. = url;
	}

Returns:
the subredditId
	public String getSubredditId() {
		return ;
	}

Parameters:
subredditId the subredditId to set
	public void setSubredditId(String subredditId) {
		this. = subredditId;
	}

Returns:
the thumbnail
	public String getThumbnail() {
		return ;
	}

Parameters:
thumbnail the thumbnail to set
	public void setThumbnail(String thumbnail) {
		this. = thumbnail;
	}

Returns:
the selftext
	public String getSelftext() {
		return ;
	}

Parameters:
selftext the selftext to set
	public void setSelftext(String selftext) {
		this. = selftext;
	}

Returns:
the selftextHTML
	public String getSelftextHTML() {
		return ;
	}

Parameters:
selftextHTML the selftextHTML to set
	public void setSelftextHTML(String selftextHTML) {
		this. = selftextHTML;
	}

Returns:
the domain
	public String getDomain() {
		return ;
	}

Parameters:
domain the domain to set
	public void setDomain(String domain) {
		this. = domain;
	}

Returns:
the bannedBy
	public String getBannedBy() {
		return ;
	}

Parameters:
bannedBy the bannedBy to set
	public void setBannedBy(String bannedBy) {
		this. = bannedBy;
	}

Returns:
the gilded
	public Long getGilded() {
		return ;
	}

Parameters:
gilded the gilded to set
	public void setGilded(Long gilded) {
		this. = gilded;
	}

Returns:
the reportCount
	public Long getReportCount() {
		return ;
	}

Parameters:
reportCount the reportCount to set
	public void setReportCount(Long reportCount) {
		this. = reportCount;
	}

Returns:
the created
	public Double getCreated() {
		return ;
	}

Parameters:
created the created to set
	public void setCreated(Double created) {
		this. = created;
	}

Returns:
the visited
	public Boolean isVisited() {
		return ;
	}

Parameters:
visited the visited to set
	public void setVisited(Boolean visited) {
		this. = visited;
	}

Returns:
the self
	public Boolean isSelf() {
		return ;
	}

Parameters:
self the self to set
	public void setSelf(Boolean self) {
		this. = self;
	}

Returns:
the saved
	public Boolean isSaved() {
		return ;
	}

Parameters:
saved the saved to set
	public void setSaved(Boolean saved) {
		this. = saved;
	}

Returns:
the edited
	public Boolean isEdited() {
		return ;
	}

Parameters:
edited the edited to set
	public void setEdited(Boolean edited) {
		this. = edited;
	}

Returns:
the stickied
	public Boolean isStickied() {
		return ;
	}

Parameters:
stickied the stickied to set
	public void setStickied(Boolean stickied) {
		this. = stickied;
	}

Returns:
the nsfw
	public Boolean isNSFW() {
		return ;
	}

Parameters:
nsfw the nsfw to set
	public void setNSFW(Boolean nsfw) {
		this. = nsfw;
	}

String representation of this Submission.

Returns:
String representation
    public String toString() {
    	return "Submission(" + this.getFullName() + ")<" +  + ">";
    }
    
    @Override
    public boolean equals(Object other) {
    	return (other instanceof Submission && this.getFullName().equals(((Submissionother).getFullName()));
    }
	public int compareTo(Thing o) {
		return this.getFullName().compareTo(o.getFullName());
	}
    
New to GrepCode? Check out our FAQ X