java.lang.Object
java.lang.Record
dev.sympho.modular_commands.api.command.parameter.parse.ChoicesParser.Choice<P>
- Type Parameters:
P
- The raw value type.- Record Components:
name
- The choice name.value
- The choice value.
public static record ChoicesParser.Choice<P extends @NonNull Object>(String name, P extends @NonNull Object value)
extends Record
A possible choice to be selected.
- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.name()
Returns the value of thename
record component.static <P extends @NonNull Object>
ChoicesParser.Choice<P>Creates a new choice.Creates a new choice mapping.final String
toString()
Returns a string representation of this record class.value()
Returns the value of thevalue
record component.
-
Constructor Details
-
Method Details
-
of
Creates a new choice.- Type Parameters:
P
- The raw value type.- Parameters:
name
- The choice name.choice
- The choice value.- Returns:
- The choice.
-
of
public static <P extends @NonNull Object,V extends @NonNull Object> Map.Entry<ChoicesParser.Choice<P>,V> of(String name, P choice, V value) Creates a new choice mapping.- Type Parameters:
P
- The raw value type.V
- The mapped value type.- Parameters:
name
- The choice name.choice
- The choice value.value
- The mapped value.- Returns:
- The choice.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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)
. -
name
Returns the value of thename
record component.- Returns:
- the value of the
name
record component
-
value
Returns the value of thevalue
record component.- Returns:
- the value of the
value
record component
-