Record Class ParseResult
java.lang.Object
java.lang.Record
me.pauleff.common.argparse.ParseResult
- Record Components:
arguments- the parsed arguments on success, ornullwhen the process should exitexitCode- a process exit code when>= 0;-1indicates a successful parse
Represents the outcome of parsing command-line arguments.
Distinguishes between a successful parse that yields ParsedArguments
and a terminal result that should end the process with an exit code.
-
Constructor Summary
ConstructorsConstructorDescriptionParseResult(ParsedArguments arguments, int exitCode) Creates an instance of aParseResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theargumentsrecord component.final booleanIndicates whether some other object is "equal to" this one.static ParseResultexit(int exitCode) Creates a terminal parse result that signals the process should exit.intexitCode()Returns the value of theexitCoderecord component.final inthashCode()Returns a hash code value for this object.booleanIndicates whether the caller should terminate instead of continuing with conversion.static ParseResultsuccess(ParsedArguments arguments) Creates a successful parse result that carries the given arguments.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Method Details
-
success
Creates a successful parse result that carries the given arguments.- Parameters:
arguments- the parsed arguments- Returns:
- a result with
exitCode-1
-
exit
Creates a terminal parse result that signals the process should exit.- Parameters:
exitCode- the process exit code to use- Returns:
- a result with
nullarguments and the given exit code
-
shouldExit
public boolean shouldExit()Indicates whether the caller should terminate instead of continuing with conversion.- Returns:
trueifexitCodeis>= 0;falseotherwise
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
arguments
-
exitCode
-