Class Value

    • Method Detail

      • get

        public abstract Object get()
        Get the wrapped value.
      • get

        public final <A> A get​(Value.ValueType<A> ev)
        Get the wrapped value in a type safe way. Use this method if you are sure about the contained value type. Otherwise consider the use of decompose(Fn, Fn, Fn, Fn, Fn).
        Parameters:
        ev - Evidence type. The type parameter A of the evidence type must match the type of the wrapped value. Any other value will result in an exception being thrown.
        Throws:
        RuntimeException - if the passed evidence ev does not match the type of the wrapped value
      • decompose

        public final <A> A decompose​(com.entwinemedia.fn.Fn<? super String,​? extends A> stringValue,
                                     com.entwinemedia.fn.Fn<? super Date,​? extends A> dateValue,
                                     com.entwinemedia.fn.Fn<? super Long,​? extends A> longValue,
                                     com.entwinemedia.fn.Fn<? super Boolean,​? extends A> booleanValue,
                                     com.entwinemedia.fn.Fn<? super Version,​? extends A> versionValue)
        Decompose (or pattern match) the value instance. Provide a function to handle each possible type. Use doNotMatch() as a placeholder that yields an Prelude.unexhaustiveMatch() error.
      • doNotMatch

        public static <B> com.entwinemedia.fn.Fn<Object,​B> doNotMatch()
        Use as a placeholder that yields an Prelude.unexhaustiveMatch() error in value decomposition.
        See Also:
        decompose(Fn, Fn, Fn, Fn, Fn)