Class Either.Failure

  • All Implemented Interfaces:
    java.io.Serializable
    Enclosing interface:
    Either<L,​R>

    public static class Either.Failure
    extends java.lang.Exception
    An exception wrapper used to propagate values through exception handling mechanisms.

    This class wraps a value in an exception to enable using exception-based control flow when working with Either. It is not possible to use a generic type parameter for the exception type due to Java type system limitations.

    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static long serialVersionUID  
      private java.lang.Object value  
    • Constructor Summary

      Constructors 
      Constructor Description
      Failure​(java.lang.Object value)
      Constructs a new Failure wrapping the given value.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object getValue()
      Returns the wrapped value.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • value

        private final java.lang.Object value
    • Constructor Detail

      • Failure

        public Failure​(java.lang.Object value)
        Constructs a new Failure wrapping the given value.
        Parameters:
        value - the value to wrap
    • Method Detail

      • getValue

        public java.lang.Object getValue()
        Returns the wrapped value.
        Returns:
        the wrapped value