Record Class DialogResponse
java.lang.Object
java.lang.Record
fr.fidorial.dialog.DialogResponse
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DialogResponseA response carrying nothing, as sent by a dialog with no input control. -
Constructor Summary
ConstructorsConstructorDescriptionDialogResponse(CompoundBinaryTag values) Creates an instance of aDialogResponserecord class. -
Method Summary
Modifier and TypeMethodDescriptionReads a value as a flag.booleanReturns whether the payload holds anything underkey.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisEmpty()Returns whether the payload is empty.keys()Returns every key the payload carries.Reads a value as a number.Reads a value as text.final StringtoString()Returns a string representation of this record class.values()Returns the value of thevaluesrecord component.
-
Field Details
-
EMPTY
A response carrying nothing, as sent by a dialog with no input control.- Since:
- 0.1.0
-
-
Constructor Details
-
DialogResponse
Creates an instance of aDialogResponserecord class.- Parameters:
values- the value for thevaluesrecord component
-
-
Method Details
-
text
-
bool
Reads a value as a flag.A checkbox arrives as a byte, but a text input configured with
custom stringsarrives as text, so"true"and"1"are accepted too.- Parameters:
key- the input key to read- Returns:
- the value, or empty when the payload holds nothing readable under that key
- Since:
- 0.1.0
-
number
Reads a value as a number.- Parameters:
key- the input key to read- Returns:
- the value, or empty when the payload holds nothing numeric under that key
- Since:
- 0.1.0
-
contains
Returns whether the payload holds anything underkey.- Parameters:
key- the input key to look up- Returns:
- whether the payload holds anything under
key - Since:
- 0.1.0
-
keys
-
isEmpty
@Contract(pure=true) public boolean isEmpty()Returns whether the payload is empty.- Returns:
- whether the payload is empty
- Since:
- 0.1.0
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
values
Returns the value of thevaluesrecord component.- Returns:
- the value of the
valuesrecord component
-