Interface MessagePoll
public interface MessagePoll
Poll sent with messages.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classOne of the answers for a poll.static enumThe poll layout.static classThe question for a poll. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMaximum length of aMessagePollBuilder.addAnswer(String)poll answer title} (55)static final intMaximum amount ofpoll answers(10)static final longMaximumdurationof poll (168L)static final intMaximum length of apoll question title(300) -
Method Summary
Modifier and TypeMethodDescription@Unmodifiable List<MessagePoll.Answer>The poll answers.The layout of the poll.The poll question, representing the title.The time when this poll will automatically expire.default booleanWhether this poll has passed itsexpiration time.booleanWhether this poll is finalized and recounted.booleanWhether this poll allows multiple answers to be selected.
-
Field Details
-
MAX_QUESTION_TEXT_LENGTH
static final int MAX_QUESTION_TEXT_LENGTHMaximum length of apoll question title(300)- See Also:
-
MAX_ANSWER_TEXT_LENGTH
static final int MAX_ANSWER_TEXT_LENGTHMaximum length of aMessagePollBuilder.addAnswer(String)poll answer title} (55)- See Also:
-
MAX_ANSWERS
static final int MAX_ANSWERSMaximum amount ofpoll answers(10)- See Also:
-
MAX_DURATION_HOURS
static final long MAX_DURATION_HOURSMaximumdurationof poll (168L)- See Also:
-
-
Method Details
-
getLayout
The layout of the poll.- Returns:
- The poll layout, or
MessagePoll.LayoutType.UNKNOWNif unknown
-
getQuestion
The poll question, representing the title.- Returns:
MessagePoll.Question
-
getAnswers
The poll answers.Each answer also has the current
votes. The votes might not be finalized and might be incorrect before the poll has expired, seeisFinalizedVotes().- Returns:
- Immutable
ListofMessagePoll.Answer
-
getTimeExpiresAt
The time when this poll will automatically expire.The author of the poll can always expire the poll manually, using
Message.endPoll().- Returns:
OffsetDateTimerepresenting the time when the poll expires automatically, or null if it never expires
-
isMultiAnswer
boolean isMultiAnswer()Whether this poll allows multiple answers to be selected.- Returns:
- True, if this poll allows multi selection
-
isFinalizedVotes
boolean isFinalizedVotes()Whether this poll is finalized and recounted.The votes for answers might be inaccurate due to eventual consistency, until this is true. Finalization does not mean the votes cannot change anymore, use
isExpired()to check if a poll has ended.- Returns:
- True, if the votes have been precisely counted
-
isExpired
default boolean isExpired()Whether this poll has passed itsexpiration time.- Returns:
- True, if this poll is expired.
-