Record Class ProcessOutput

java.lang.Object
java.lang.Record
com.suse.common.io.process.ProcessOutput

public record ProcessOutput(int exitCode, String standardOutput, String standardError) extends Record
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final int
    The field for the exitCode record component.
    private final String
    The field for the standardError record component.
    private final String
    The field for the standardOutput record component.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ProcessOutput(int exitCode, String standardOutput, String standardError)
    Creates an instance of a ProcessOutput record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    int
    Returns the value of the exitCode record component.
    boolean
    Checks if process output is failed
    Retrieves the error message, if any
    final int
    Returns a hash code value for this object.
    boolean
    Checks if there is a meaningful standard error
    boolean
    Checks if there is a meaningful standard output
    Returns the value of the standardError record component.
    Returns the value of the standardOutput record component.
    boolean
    Checks if process output is succeeded
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • exitCode

      private final int exitCode
      The field for the exitCode record component.
    • standardOutput

      private final String standardOutput
      The field for the standardOutput record component.
    • standardError

      private final String standardError
      The field for the standardError record component.
  • Constructor Details

    • ProcessOutput

      public ProcessOutput(int exitCode, String standardOutput, String standardError)
      Creates an instance of a ProcessOutput record class.
      Parameters:
      exitCode - the value for the exitCode record component
      standardOutput - the value for the standardOutput record component
      standardError - the value for the standardError record component
  • Method Details

    • succeeded

      public boolean succeeded()
      Checks if process output is succeeded
      Returns:
      true if process output is succeeded
    • failed

      public boolean failed()
      Checks if process output is failed
      Returns:
      true if process output is failed
    • getErrorMessage

      public String getErrorMessage()
      Retrieves the error message, if any
      Returns:
      the error message
    • hasStandardOutput

      public boolean hasStandardOutput()
      Checks if there is a meaningful standard output
      Returns:
      true if there is a meaningful standard output
    • hasStandardError

      public boolean hasStandardError()
      Checks if there is a meaningful standard error
      Returns:
      true if there is a meaningful standard error
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • exitCode

      public int exitCode()
      Returns the value of the exitCode record component.
      Returns:
      the value of the exitCode record component
    • standardOutput

      public String standardOutput()
      Returns the value of the standardOutput record component.
      Returns:
      the value of the standardOutput record component
    • standardError

      public String standardError()
      Returns the value of the standardError record component.
      Returns:
      the value of the standardError record component