Class AbstractExitStatus
java.lang.Object
gov.nist.secauto.metaschema.cli.processor.AbstractExitStatus
- All Implemented Interfaces:
ExitStatus
- Direct Known Subclasses:
MessageExitStatus,NonMessageExitStatus
Records information about the exit status of a CLI command.
This abstract class provides base functionality for handling CLI command exit
statuses, including error logging and throwable management. Implementing
classes must provide the ExitStatus.getMessage() implementation to define the
status message content.
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractExitStatus(ExitCode exitCode) Construct a new exit status based on the providedexitCode. -
Method Summary
Modifier and TypeMethodDescriptionvoidgenerateMessage(boolean showStackTrace) Generates and logs a message based on the current exit status.Get the exit code information associated with this exit status.Get the associated throwable.withThrowable(Throwable throwable) Associate a throwable with the exit status.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface gov.nist.secauto.metaschema.cli.processor.ExitStatus
getMessage
-
Constructor Details
-
AbstractExitStatus
Construct a new exit status based on the providedexitCode.- Parameters:
exitCode- the exit code
-
-
Method Details
-
getExitCode
Description copied from interface:ExitStatusGet the exit code information associated with this exit status.- Specified by:
getExitCodein interfaceExitStatus- Returns:
- the exit code information
-
getThrowable
Get the associated throwable.- Specified by:
getThrowablein interfaceExitStatus- Returns:
- the throwable or
null
-
withThrowable
Description copied from interface:ExitStatusAssociate a throwable with the exit status.- Specified by:
withThrowablein interfaceExitStatus- Parameters:
throwable- the throwable- Returns:
- this exit status
-
generateMessage
Generates and logs a message based on the current exit status. The message is logged at either INFO level (for success/info status) or ERROR level (for error status).- Specified by:
generateMessagein interfaceExitStatus- Parameters:
showStackTrace- iftrueand a throwable is present, includes the stack trace in the log- See Also:
-