Interface RequestOperation
public interface RequestOperation
Operation providing means to select from a set of answers.
- Since:
- 4.2.427
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Definition of an answer object.static enum
The kind of the operation. -
Field Summary
Modifier and TypeFieldDescriptionstatic final OperationType<RequestOperation>
The operation's type. -
Method Summary
Modifier and TypeMethodDescriptionAdd an answer with the given label.Adds an answer with a language dependent label for "cancel".addNo()
Adds an answer with a language dependent label for "no".addOk()
Adds an answer with a language dependent label for "ok".addYes()
Adds an answer with a language dependent label for "yes".@Nullable RequestOperation.Answer
Asks the given question, returning the selected answer.void
Defines the answer to be initially selected.void
setKind
(@NotNull RequestOperation.Kind kind) Set the kind of request to be answered.void
Set the title of the selection.
-
Field Details
-
TYPE
The operation's type.- Since:
- 4.2.427
-
-
Method Details
-
setTitle
Set the title of the selection.- Parameters:
title
- The selection operation's title.- Since:
- 4.2.427
-
setKind
Set the kind of request to be answered. Defaults toRequestOperation.Kind.INFO
.- Parameters:
kind
- The request kind.- Since:
- 4.2.427
-
addAnswer
Add an answer with the given label. Answers will be displayed in the order added.- Parameters:
label
- The label.- Since:
- 4.2.427
-
addYes
RequestOperation.Answer addYes()Adds an answer with a language dependent label for "yes".- Returns:
- The yes-answer
- Since:
- 4.2.427
-
addNo
RequestOperation.Answer addNo()Adds an answer with a language dependent label for "no".- Returns:
- The no-answer
- Since:
- 4.2.427
-
addOk
RequestOperation.Answer addOk()Adds an answer with a language dependent label for "ok".- Returns:
- The ok-answer
- Since:
- 4.2.427
-
addCancel
RequestOperation.Answer addCancel()Adds an answer with a language dependent label for "cancel".- Returns:
null
- Since:
- 4.2.427
-
setInitialAnswer
Defines the answer to be initially selected. Defaults to the last added answer.- Parameters:
answer
- The initial answer.- Since:
- 4.2.427
-
perform
Asks the given question, returning the selected answer.- Parameters:
question
- The question to be asked.- Returns:
- The selected answer or
null
, if the request was closed with no answer. - Since:
- 4.2.427
-