Interface ErrorHandlingStrategy
-
- All Known Implementing Classes:
DefaultErrorHandlingStrategy,InjectValueErrorHandlingStrategy
public interface ErrorHandlingStrategyThis class is called in error situations. This lets' users configure the behaviour in scenarios where these scenarios appear.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <T> ThandleIllegalEval(String message, T defaultValue)This handler is called in case there is some bug in the evaluation.<T> ThandleMissingValue(String path, T defaultValue)This handler is invoked when a value cannot be resolved from a path.<T> ThandleTypeMismatch(String path, String expected, String actual, T defaultValue)This handler is invoked when there is type mismatch between value at path and that present in json.default voidparamValidationFailure(String checkFailureMessage)This handler is invoked when param evaluation in aHopeFunctionevaluation fails
-
-
-
Method Detail
-
handleMissingValue
<T> T handleMissingValue(String path, T defaultValue)
This handler is invoked when a value cannot be resolved from a path. This happens when value is not present or null.- Type Parameters:
T- Type of default Value- Parameters:
path- Path for which value was not founddefaultValue- Default value to be returned if present- Returns:
- defaultValue or exception depending on implementation
-
handleTypeMismatch
<T> T handleTypeMismatch(String path, String expected, String actual, T defaultValue)
This handler is invoked when there is type mismatch between value at path and that present in json.- Type Parameters:
T- Type of defaultValue- Parameters:
path- Path for which value mismatch was detectedexpected- Expected typeactual- Type found in provided jsondefaultValue- Default value to be returned in case of mismatch- Returns:
- defaultValue or throws exception depending on implementation
-
paramValidationFailure
default void paramValidationFailure(String checkFailureMessage)
This handler is invoked when param evaluation in aHopeFunctionevaluation fails- Parameters:
checkFailureMessage- Message describing the failure
-
handleIllegalEval
<T> T handleIllegalEval(String message, T defaultValue)
This handler is called in case there is some bug in the evaluation. This should never be raised faced in production. In case this happens it is a bug that should be reported.- Type Parameters:
T- Type of defaultValue- Parameters:
message- Custom message provided at assertion sitedefaultValue- Default value to be returned if this state is faced- Returns:
- defaultValue or throws exception depending on implementation
-
-