Class SMFPartialLogged<A>

  • Type Parameters:
    A - The type of result values.

    public final class SMFPartialLogged<A>
    extends java.lang.Object
    The result of evaluating a partial function, with log messages.
    • Method Detail

      • failed

        public static <A> SMFPartialLogged<A> failed​(java.util.List<? extends SMFErrorType> inErrors,
                                                     java.util.List<? extends SMFWarningType> inWarnings)
        Fail an operation.
        Type Parameters:
        A - The type of result values
        Parameters:
        inErrors - The errors encountered
        inWarnings - The warnings encountered
        Returns:
        A failed operation
      • failed

        public static <A> SMFPartialLogged<A> failed​(java.util.List<? extends SMFErrorType> inErrors)
        Fail an operation.
        Type Parameters:
        A - The type of result values
        Parameters:
        inErrors - The errors encountered
        Returns:
        A failed operation
      • failed

        public static <A> SMFPartialLogged<A> failed​(SMFErrorType inError)
        Fail an operation.
        Type Parameters:
        A - The type of result values
        Parameters:
        inError - The error encountered
        Returns:
        A failed operation
      • succeeded

        public static <A> SMFPartialLogged<A> succeeded​(java.util.List<? extends SMFErrorType> inErrors,
                                                        java.util.List<? extends SMFWarningType> inWarnings,
                                                        A inValue)
        Succeed an operation.
        Type Parameters:
        A - The type of result values
        Parameters:
        inErrors - The errors encountered
        inWarnings - The warnings encountered
        inValue - The result of the operation
        Returns:
        A succeeded operation
      • succeeded

        public static <A> SMFPartialLogged<A> succeeded​(A inValue)
        Succeed an operation with nothing logged.
        Type Parameters:
        A - The type of result values
        Parameters:
        inValue - The result of the operation
        Returns:
        A succeeded operation
      • get

        public A get()
              throws java.lang.IllegalStateException
        Returns:
        The result of the operation if it succeeded
        Throws:
        java.lang.IllegalStateException - If the operation failed
      • errors

        public java.util.List<? extends SMFErrorType> errors()
      • warnings

        public java.util.List<? extends SMFWarningType> warnings()
      • isFailed

        public boolean isFailed()
        Returns:
        true if the operation failed
      • isSucceeded

        public boolean isSucceeded()
        Returns:
        true if the operation succeeded
      • map

        public <B> SMFPartialLogged<B> map​(java.util.function.Function<A,​B> f)
        Functor map for partials.
        Type Parameters:
        B - The type of mapped values
        Parameters:
        f - A function to apply to the value
        Returns:
        f(x)
      • flatMap

        public <B> SMFPartialLogged<B> flatMap​(java.util.function.Function<A,​SMFPartialLogged<B>> f)
        Monadic bind for partials.
        Type Parameters:
        B - The type of mapped values
        Parameters:
        f - A function to apply to the value
        Returns:
        this >>= f