1 /* 2 * SPDX-FileCopyrightText: none 3 * SPDX-License-Identifier: CC0-1.0 4 */ 5 6 package gov.nist.secauto.metaschema.cli.processor; 7 8 import edu.umd.cs.findbugs.annotations.NonNull; 9 import edu.umd.cs.findbugs.annotations.Nullable; 10 11 /** 12 * Implementations provide details around the result of processing a set of 13 * command line arguments. 14 */ 15 public interface ExitStatus { 16 /** 17 * Get the exit code information associated with this exit status. 18 * 19 * @return the exit code information 20 */ 21 @NonNull 22 ExitCode getExitCode(); 23 24 /** 25 * Get a throwable that is associated with this exit status. 26 * 27 * @return the throwable or {@code null} if no throwable is associated 28 */ 29 @Nullable 30 Throwable getThrowable(); 31 32 /** 33 * Process the exit status. 34 * 35 * @param showStackTrace 36 * include the stack trace for the throwable, if associated 37 * @see #withThrowable(Throwable) 38 */ 39 void generateMessage(boolean showStackTrace); 40 41 /** 42 * Get the associated message, or {@code null} if there is no message. 43 * 44 * @return the message or {@code null} 45 */ 46 @Nullable 47 String getMessage(); 48 49 /** 50 * Associate a throwable with the exit status. 51 * 52 * @param throwable 53 * the throwable 54 * @return this exit status 55 */ 56 @NonNull 57 ExitStatus withThrowable(@NonNull Throwable throwable); 58 }