Package vertxval.exp

Class And

    • Method Detail

      • map

        public <P> Val<P> map​(Function<Boolean,​P> fn)
        Description copied from interface: Val
        Creates a new value by applying a function to the successful result of this value. If this value returns an exception then the new value will also contain this exception.
        Type Parameters:
        P - the type of the returned value
        Parameters:
        fn - the function which will be applied to the successful result of this value
        Returns:
        a new value
      • retry

        public Val<Boolean> retry​(int attempts)
        Description copied from interface: Val
        returns a new value tha will retry its execution if it fails
        Parameters:
        attempts - the number of attempts before returning an error
        Returns:
        a new value
      • retry

        public Val<Boolean> retry​(int attempts,
                                  BiFunction<Throwable,​Integer,​Val<Void>> actionBeforeRetry)
        Description copied from interface: Val
        returns a new value tha will retry its execution after the an action.
        Parameters:
        attempts - the number of attempts before returning an error
        actionBeforeRetry - the function that produces the action to be executed before the retry
        Returns:
        a new value
      • retryIf

        public Val<Boolean> retryIf​(Predicate<Throwable> predicate,
                                    int attempts)
        Description copied from interface: Val
        returns a new value tha will retry its execution if it fails with an error that satisfies the given predicate.
        Parameters:
        predicate - the predicate against which the returned error will be tested on
        attempts - the number of attempts before returning an error
        Returns:
        a new value
      • retryIf

        public Val<Boolean> retryIf​(Predicate<Throwable> predicate,
                                    int attempts,
                                    BiFunction<Throwable,​Integer,​Val<Void>> actionBeforeRetry)
        Description copied from interface: Val
        returns a new value tha will retry its execution after an action if it fails with an error that satisfies the given predicate.
        Parameters:
        predicate - the predicate against which the returned error will be tested on
        attempts - the number of attempts before returning an error
        actionBeforeRetry - the function that produces the action to be executed before the retry
        Returns:
        a new value
      • get

        public io.vertx.core.Future<Boolean> get()
      • recover

        public Val<O> recover​(Function<Throwable,​O> fn)
        Description copied from interface: Val
        Creates a new value that will handle any matching throwable that this value might contain. If there is no match, or if this future contains a valid result then the new future will contain the same.
        Specified by:
        recover in interface Val<O>
        Parameters:
        fn - the function to apply if this value fails
        Returns:
        a new value
      • recoverWith

        public Val<O> recoverWith​(Function<Throwable,​Val<O>> fn)
        Description copied from interface: Val
        Creates a new value that will handle any matching throwable that this value might contain by assigning it another value.
        Specified by:
        recoverWith in interface Val<O>
        Parameters:
        fn - the function to apply if this Future fails
        Returns:
        a new value
      • flatMap

        public <Q> Val<Q> flatMap​(Function<O,​Val<Q>> fn)
        Description copied from interface: Val
        Creates a new value by applying a function to the successful result of this value, and returns the result of the function as the new value. If this value returns an exception then the new value will also contain this exception.
        Specified by:
        flatMap in interface Val<O>
        Type Parameters:
        Q - the type of the returned value
        Parameters:
        fn - the function which will be applied to the successful result of this value
        Returns:
        a new value
      • onSuccess

        public Val<O> onSuccess​(Consumer<O> success)
        Description copied from interface: Val
        Adds a consumer to be notified of the succeeded result of this value.
        Specified by:
        onSuccess in interface Val<O>
        Parameters:
        success - the consumer that will be called with the succeeded result
        Returns:
        a reference to this value, so it can be used fluently
      • onComplete

        public Val<O> onComplete​(Consumer<O> successConsumer,
                                 Consumer<Throwable> failure)
        Description copied from interface: Val
        Add a handler to be notified of the result.
        Specified by:
        onComplete in interface Val<O>
        Parameters:
        successConsumer - the handler that will be called with the succeeded result
        failure - the handler that will be called with the failed result
        Returns:
        a reference to this, so it can be used fluently
      • onComplete

        public Val<O> onComplete​(io.vertx.core.Handler<io.vertx.core.AsyncResult<O>> handler)
        Description copied from interface: Val
        Add a handler to be notified of the result.
        Specified by:
        onComplete in interface Val<O>
        Parameters:
        handler - the handler that will be called with the result
        Returns:
        a reference to this, so it can be used fluently