Class KiwiCloseables.CloseResult

java.lang.Object
org.kiwiproject.beta.base.KiwiCloseables.CloseResult
Enclosing class:
KiwiCloseables

public static class KiwiCloseables.CloseResult extends Object
Represents the result of an attempt to close an object.
  • Method Details

    • ofClosed

      public static KiwiCloseables.CloseResult ofClosed()
      Create a new "closed successfully" instance.
      Returns:
      a new instance that indicates that an object was successfully closed
    • ofNull

      public static KiwiCloseables.CloseResult ofNull()
      Create a new "object was null" instance.
      Returns:
      a new instance that indicates an object was null (and thus not closed)
    • ofError

      public static KiwiCloseables.CloseResult ofError(Exception exception)
      Create a new "close failed" instance.
      Parameters:
      exception - the error that occurred closing an object
      Returns:
      a new instance representing a failed close attempt, including the Exception
    • closedOrWasNull

      public boolean closedOrWasNull()
      Returns:
      true if the object was successfully closed or was null, otherwise false
    • hasError

      public boolean hasError()
      Returns:
      true if the close operation failed, otherwise false
    • closed

      public boolean closed()
      If true, the object was successfully closed.
    • wasNull

      public boolean wasNull()
      If true, the object was null.
    • error

      public @Nullable Exception error()
      If an error occurred closing an object, this contains the Exception that was thrown. If there was no error, this will be null.