Class ScalarWithFallback<T>

  • Type Parameters:
    T - Type of result
    All Implemented Interfaces:
    Scalar<T>

    public final class ScalarWithFallback<T>
    extends Object
    implements Scalar<T>
    Scalar with fallbacks that enable it to recover from errors.

    There is no thread-safety guarantee.

    Since:
    0.31
    See Also:
    FuncWithFallback
    • Constructor Detail

      • ScalarWithFallback

        @SafeVarargs
        public ScalarWithFallback​(Scalar<? extends T> origin,
                                  Fallback<? extends T>... fbks)
        Ctor.
        Parameters:
        origin - Original scalar
        fbks - The fallbacks
      • ScalarWithFallback

        public ScalarWithFallback​(Scalar<? extends T> origin,
                                  Iterable<? extends Fallback<? extends T>> fbks)
        Ctor.
        Parameters:
        origin - Original scalar
        fbks - Fallbacks
    • Method Detail

      • value

        public T value()
                throws Exception
        Description copied from interface: Scalar
        Convert it to the value.
        Specified by:
        value in interface Scalar<T>
        Returns:
        The value
        Throws:
        Exception - If fails