Class ValueWrapper<T>

  • Type Parameters:
    T -

    public class ValueWrapper<T>
    extends Object
    Utility 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 Detail

      • errorWithValidValue

        public static <T> ValueWrapper<T> errorWithValidValue​(T value,
                                                              T expected)
      • errorWithMessage

        public static <T> ValueWrapper<T> errorWithMessage​(String message)
      • errorEmptyMessage

        public static <T> ValueWrapper<T> errorEmptyMessage()
      • errorWithCollectionPathToValue

        public static <T> ValueWrapper<T> errorWithCollectionPathToValue​(T value,
                                                                         List<String> path)
      • isValid

        public boolean isValid()
      • getValue

        public T getValue()
      • getExpected

        public T getExpected()
      • getCollectionPathToValue

        public List<String> getCollectionPathToValue()
      • orElse

        public T orElse​(T defaultValue)
      • orElseGet

        public T orElseGet​(Supplier<T> defaultSupplier)