org.springframework.boot.util

Class LambdaSafe.InvocationResult<R>

  • Type Parameters:
    R - the result type
    Enclosing class:
    LambdaSafe


    public static final class LambdaSafe.InvocationResult<R>
    extends Object
    The result of a callback which may be a value, null or absent entirely if the callback wasn't suitable. Similar in design to Optional but allows for null as a valid value.
    • Method Detail

      • hasResult

        public boolean hasResult()
        Return true if a result in present.
        Returns:
        if a result is present
      • get

        public R get()
        Return the result of the invocation or null if the callback wasn't suitable.
        Returns:
        the result of the invocation or null
      • get

        public R get(R fallback)
        Return the result of the invocation or the given fallback if the callback wasn't suitable.
        Parameters:
        fallback - the fallback to use when there is no result
        Returns:
        the result of the invocation or the fallback