Record Class CommandArgument
java.lang.Object
java.lang.Record
org.springframework.shell.core.command.CommandArgument
public record CommandArgument(int index, @Nullable String description, @Nullable String defaultValue, @Nullable String value, Class<?> type)
extends Record
Record representing the definition as well as the runtime information about a command
argument.
- Since:
- 4.0.0
- Author:
- Mahmoud Ben Hassine
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionCommandArgument(int index, @Nullable String description, @Nullable String defaultValue, @Nullable String value, Class<?> type) Creates an instance of aCommandArgumentrecord class. -
Method Summary
Modifier and TypeMethodDescription@Nullable StringReturns the value of thedefaultValuerecord component.@Nullable StringReturns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intindex()Returns the value of theindexrecord component.final StringtoString()Returns a string representation of this record class.Class<?>type()Returns the value of thetyperecord component.@Nullable Stringvalue()Returns the value of thevaluerecord component.static CommandArgument.Builderwith()
-
Constructor Details
-
CommandArgument
public CommandArgument(int index, @Nullable String description, @Nullable String defaultValue, @Nullable String value, Class<?> type) Creates an instance of aCommandArgumentrecord class.- Parameters:
index- the value for theindexrecord componentdescription- the value for thedescriptionrecord componentdefaultValue- the value for thedefaultValuerecord componentvalue- the value for thevaluerecord componenttype- the value for thetyperecord component
-
-
Method Details
-
with
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
index
public int index()Returns the value of theindexrecord component.- Returns:
- the value of the
indexrecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
defaultValue
Returns the value of thedefaultValuerecord component.- Returns:
- the value of the
defaultValuerecord component
-
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-