- java.lang.Object
-
- com.github.rvesse.airline.types.ConvertResult
-
public class ConvertResult extends java.lang.Object
Helper class used to represent the result of an attempted conversion. Primarily used internally byDefaultTypeConverter
but may be generally useful for implementing customTypeConverter
implementations or extending the DefaultTypeConverter
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Throwable
cause
static ConvertResult
FAILURE
Special constant instance used to indicate failureprivate boolean
success
private java.lang.Object
value
-
Constructor Summary
Constructors Modifier Constructor Description private
ConvertResult()
Creates a basic convert result that indicates failureConvertResult(java.lang.Object value)
Creates a new conversion result that indicates successConvertResult(java.lang.Throwable cause)
Creates a new conversion result that indicates failure
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.Throwable
getCause()
Gets the cause if availablejava.lang.Object
getConvertedValue()
The converted valueboolean
hasCause()
Gets whether a cause is availableboolean
wasSuccessful()
Whether the conversion was successfulboolean
wasSuccessfull()
Deprecated.Use correctly spelled overloadwasSuccessful()
instead
-
-
-
Field Detail
-
value
private final java.lang.Object value
-
success
private final boolean success
-
cause
private final java.lang.Throwable cause
-
FAILURE
public static final ConvertResult FAILURE
Special constant instance used to indicate failure
-
-
Constructor Detail
-
ConvertResult
private ConvertResult()
Creates a basic convert result that indicates failure
-
ConvertResult
public ConvertResult(java.lang.Object value)
Creates a new conversion result that indicates success- Parameters:
value
- Converted value
-
ConvertResult
public ConvertResult(java.lang.Throwable cause)
Creates a new conversion result that indicates failure- Parameters:
cause
- Cause of the failure
-
-
Method Detail
-
wasSuccessful
public boolean wasSuccessful()
Whether the conversion was successful- Returns:
- True if successful, false otherwise
-
wasSuccessfull
@Deprecated public boolean wasSuccessfull()
Deprecated.Use correctly spelled overloadwasSuccessful()
insteadWhether the conversion was successful- Returns:
- True if successful, false otherwise
-
getConvertedValue
public java.lang.Object getConvertedValue()
The converted value- Returns:
- Converted value
-
hasCause
public boolean hasCause()
Gets whether a cause is available- Returns:
- Cause
-
getCause
public java.lang.Throwable getCause()
Gets the cause if available- Returns:
- Cause, or
null
if none available
-
-