Class ValueWrapper<T>
- java.lang.Object
-
- org.drools.scenariosimulation.backend.runner.model.ValueWrapper<T>
-
- Type Parameters:
T-
public class ValueWrapper<T> extends java.lang.ObjectUtility class to wrap a value with the possibility to specify error message or propose valid value. - collectionPathToValue: In case of a failure with a collection value type, it holds the path to reach the wrong value Note: null can be used as value.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> ValueWrapper<T>errorEmptyMessage()static <T> ValueWrapper<T>errorWithCollectionPathToValue(T value, java.util.List<java.lang.String> path)static <T> ValueWrapper<T>errorWithMessage(java.lang.String message)static <T> ValueWrapper<T>errorWithValidValue(T value, T expected)java.util.List<java.lang.String>getCollectionPathToValue()java.util.Optional<java.lang.String>getErrorMessage()TgetExpected()TgetValue()booleanisValid()static <T> ValueWrapper<T>of(T value)TorElse(T defaultValue)TorElseGet(java.util.function.Supplier<T> defaultSupplier)
-
-
-
Method Detail
-
of
public static <T> ValueWrapper<T> of(T value)
-
errorWithValidValue
public static <T> ValueWrapper<T> errorWithValidValue(T value, T expected)
-
errorWithMessage
public static <T> ValueWrapper<T> errorWithMessage(java.lang.String message)
-
errorEmptyMessage
public static <T> ValueWrapper<T> errorEmptyMessage()
-
errorWithCollectionPathToValue
public static <T> ValueWrapper<T> errorWithCollectionPathToValue(T value, java.util.List<java.lang.String> path)
-
isValid
public boolean isValid()
-
getValue
public T getValue()
-
getExpected
public T getExpected()
-
getErrorMessage
public java.util.Optional<java.lang.String> getErrorMessage()
-
getCollectionPathToValue
public java.util.List<java.lang.String> getCollectionPathToValue()
-
-