Package org.kiwiproject.beta.base
Class KiwiCloseables.CloseResult
java.lang.Object
org.kiwiproject.beta.base.KiwiCloseables.CloseResult
- Enclosing class:
- KiwiCloseables
Represents the result of an attempt to close an object.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanclosed()If true, the object was successfully closed.boolean@Nullable Exceptionerror()If an error occurred closing an object, this contains theExceptionthat was thrown.booleanhasError()static KiwiCloseables.CloseResultofClosed()Create a new "closed successfully" instance.static KiwiCloseables.CloseResultCreate a new "close failed" instance.static KiwiCloseables.CloseResultofNull()Create a new "object was null" instance.booleanwasNull()If true, the object was null.
-
Method Details
-
ofClosed
Create a new "closed successfully" instance.- Returns:
- a new instance that indicates that an object was successfully closed
-
ofNull
Create a new "object was null" instance.- Returns:
- a new instance that indicates an object was null (and thus not closed)
-
ofError
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
If an error occurred closing an object, this contains theExceptionthat was thrown. If there was no error, this will benull.
-