001/*
002 * SPDX-FileCopyrightText: none
003 * SPDX-License-Identifier: CC0-1.0
004 */
005
006package gov.nist.secauto.metaschema.cli.processor;
007
008import edu.umd.cs.findbugs.annotations.NonNull;
009import edu.umd.cs.findbugs.annotations.Nullable;
010
011/**
012 * Implementations provide details around the result of processing a set of
013 * command line arguments.
014 */
015public interface ExitStatus {
016  /**
017   * Get the exit code information associated with this exit status.
018   *
019   * @return the exit code information
020   */
021  @NonNull
022  ExitCode getExitCode();
023
024  /**
025   * Get a throwable that is associated with this exit status.
026   *
027   * @return the throwable or {@code null} if no throwable is associated
028   */
029  @Nullable
030  Throwable getThrowable();
031
032  /**
033   * Process the exit status.
034   *
035   * @param showStackTrace
036   *          include the stack trace for the throwable, if associated
037   * @see #withThrowable(Throwable)
038   */
039  void generateMessage(boolean showStackTrace);
040
041  /**
042   * Get the associated message, or {@code null} if there is no message.
043   *
044   * @return the message or {@code null}
045   */
046  @Nullable
047  String getMessage();
048
049  /**
050   * Associate a throwable with the exit status.
051   *
052   * @param throwable
053   *          the throwable
054   * @return this exit status
055   */
056  @NonNull
057  ExitStatus withThrowable(@NonNull Throwable throwable);
058}