Class Poll
-
- All Implemented Interfaces:
-
io.getstream.chat.android.models.querysort.ComparableFieldProvider
@Immutable() public final class Poll implements ComparableFieldProvider
The Poll object represents a poll in a channel.
-
-
Field Summary
Fields Modifier and Type Field Description private final Stringidprivate final Stringnameprivate final Stringdescriptionprivate final List<Option>optionsprivate final VotingVisibilityvotingVisibilityprivate final BooleanenforceUniqueVoteprivate final IntegermaxVotesAllowedprivate final BooleanallowUserSuggestedOptionsprivate final BooleanallowAnswersprivate final IntegervoteCountprivate final Map<String, Integer>voteCountsByOptionprivate final List<Vote>votesprivate final List<Vote>ownVotesprivate final DatecreatedAtprivate final DateupdatedAtprivate final Booleanclosedprivate final IntegeranswersCountprivate final List<Answer>answersprivate final UsercreatedByprivate final Map<String, Object>extraData
-
Constructor Summary
Constructors Constructor Description Poll(String id, String name, String description, List<Option> options, VotingVisibility votingVisibility, Boolean enforceUniqueVote, Integer maxVotesAllowed, Boolean allowUserSuggestedOptions, Boolean allowAnswers, Integer voteCount, Map<String, Integer> voteCountsByOption, List<Vote> votes, List<Vote> ownVotes, Date createdAt, Date updatedAt, Boolean closed, Integer answersCount, List<Answer> answers, User createdBy, Map<String, Object> extraData)
-
Method Summary
Modifier and Type Method Description final StringgetId()The unique identifier of the poll. final StringgetName()The name of the poll. final StringgetDescription()The description of the poll. final List<Option>getOptions()The list of options for the poll. final VotingVisibilitygetVotingVisibility()The visibility of the votes. final BooleangetEnforceUniqueVote()If set to true, a user can only vote once. final IntegergetMaxVotesAllowed()The maximum number of votes a user can cast, or null for unlimited votes. final BooleangetAllowUserSuggestedOptions()If set to true, users can suggest new options. final BooleangetAllowAnswers()If set to true, users can vote. final IntegergetVoteCount()The total number of votes cast in the poll. final Map<String, Integer>getVoteCountsByOption()The number of votes for each option. final List<Vote>getVotes()The list of votes. final List<Vote>getOwnVotes()The list of votes cast by the current user. final DategetCreatedAt()The creation date of the poll. final DategetUpdatedAt()The last update date of the poll. final BooleangetClosed()If set to true, the poll is closed and no more votes can be cast. final IntegergetAnswersCount()The total number of answers in the poll. final List<Answer>getAnswers()The list of poll answers. final UsergetCreatedBy()The user who created the poll. final Map<String, Object>getExtraData()Any additional data associated with the poll. final List<Vote>getVotes(Option option)Get the votes for a specific option. Comparable<?>getComparableField(String fieldName)Gets a comparable fields from a name. -
-
Constructor Detail
-
Poll
Poll(String id, String name, String description, List<Option> options, VotingVisibility votingVisibility, Boolean enforceUniqueVote, Integer maxVotesAllowed, Boolean allowUserSuggestedOptions, Boolean allowAnswers, Integer voteCount, Map<String, Integer> voteCountsByOption, List<Vote> votes, List<Vote> ownVotes, Date createdAt, Date updatedAt, Boolean closed, Integer answersCount, List<Answer> answers, User createdBy, Map<String, Object> extraData)
-
-
Method Detail
-
getDescription
final String getDescription()
The description of the poll.
-
getOptions
final List<Option> getOptions()
The list of options for the poll.
-
getVotingVisibility
final VotingVisibility getVotingVisibility()
The visibility of the votes. If set to VotingVisibility.ANONYMOUS, the votes will be anonymous.
-
getEnforceUniqueVote
final Boolean getEnforceUniqueVote()
If set to true, a user can only vote once.
-
getMaxVotesAllowed
final Integer getMaxVotesAllowed()
The maximum number of votes a user can cast, or null for unlimited votes.
-
getAllowUserSuggestedOptions
final Boolean getAllowUserSuggestedOptions()
If set to true, users can suggest new options.
-
getAllowAnswers
final Boolean getAllowAnswers()
If set to true, users can vote.
-
getVoteCount
final Integer getVoteCount()
The total number of votes cast in the poll.
-
getVoteCountsByOption
final Map<String, Integer> getVoteCountsByOption()
The number of votes for each option.
-
getOwnVotes
final List<Vote> getOwnVotes()
The list of votes cast by the current user.
-
getCreatedAt
final Date getCreatedAt()
The creation date of the poll.
-
getUpdatedAt
final Date getUpdatedAt()
The last update date of the poll.
-
getClosed
final Boolean getClosed()
If set to true, the poll is closed and no more votes can be cast.
-
getAnswersCount
final Integer getAnswersCount()
The total number of answers in the poll.
-
getAnswers
final List<Answer> getAnswers()
The list of poll answers.
-
getCreatedBy
final User getCreatedBy()
The user who created the poll. This property is optional and might be null.
-
getExtraData
final Map<String, Object> getExtraData()
Any additional data associated with the poll.
-
getVotes
final List<Vote> getVotes(Option option)
Get the votes for a specific option.
- Parameters:
option- The option to get the votes for.- Returns:
The list of votes for the option.
-
getComparableField
Comparable<?> getComparableField(String fieldName)
Gets a comparable fields from a name.
-
-
-
-