Package org.kiwiproject.beta.base
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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanclosed()If true the object was successfully closed.booleanclosedOrWasNull()@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.CloseResultofError(Exception exception)Create a new "close failed" instance.static KiwiCloseables.CloseResultofNull()Create a new "object was null" instance.booleanwasNull()If true the object was null.
-
-
-
Method Detail
-
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.
-
-