Class Failure<T,E extends Exception>
- java.lang.Object
-
- com.identityworksllc.iiq.common.vo.Failure<T,E>
-
- Type Parameters:
T
- The type of the object that failed to be processedE
- The error type
- All Implemented Interfaces:
Serializable
public class Failure<T,E extends Exception> extends Object implements Serializable
A container object holding a failure, usually used in a threaded context.This indicates that the operation processing the given object of type
T
failed with an exception of typeE
.The
ThrowableSerializer
is used to make these objects JSON-friendly, but the output cannot be converted back to a Failure.If the object of type
T
is not null, it must be serializable by Jackson, either by default, via annotations, or via some mix-in.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Failure(E exception)
Constructs a new Failure with an exception but no objectFailure(T object)
Constructs a new Failure with an object but no exceptionFailure(T object, E exception)
Constructs a new failure with both an object and an exception
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description E
getException()
Gets the stored exception if one existsT
getObject()
Gets the stored object if one exists
-
-
-
Method Detail
-
getException
public E getException()
Gets the stored exception if one exists- Returns:
- The stored exception
-
-