- java.lang.Object
-
- com.github.rvesse.airline.types.ConvertResult
-
public class ConvertResult extends java.lang.ObjectHelper class used to represent the result of an attempted conversion. Primarily used internally byDefaultTypeConverterbut may be generally useful for implementing customTypeConverterimplementations or extending the DefaultTypeConverter
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Throwablecausestatic ConvertResultFAILURESpecial constant instance used to indicate failureprivate booleansuccessprivate java.lang.Objectvalue
-
Constructor Summary
Constructors Modifier Constructor Description privateConvertResult()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.ThrowablegetCause()Gets the cause if availablejava.lang.ObjectgetConvertedValue()The converted valuebooleanhasCause()Gets whether a cause is availablebooleanwasSuccessful()Whether the conversion was successfulbooleanwasSuccessfull()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
nullif none available
-
-