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   * Associate a throwable with the exit status.
043   *
044   * @param throwable
045   *          the throwable
046   * @return this exit status
047   */
048  @NonNull
049  ExitStatus withThrowable(@NonNull Throwable throwable);
050}