Class List Method List File List

# Class: Vertx::Future

Inherits:
  Object
  - Object
  - Vertx::Future
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/future.rb

## Direct Known Subclasses

CompositeFuture, VertxWeb::BridgeEvent

## Class Method Summary (collapse)

- + (Object) failed_future(failureMessage = nil)
- + (Object) future
- + (Object) succeeded_future(result = nil)

## Instance Method Summary (collapse)

- - (Object) cause
- - (Object) complete(result = nil)
- - (Boolean) complete?
- - (Object) completer
- - (Object) compose(param_1 = nil, param_2 = nil)
- - (Object) fail(param_1 = nil)
- - (Boolean) failed?
- - (Future) initialize(j_del) constructor
  A new instance of Future.
- - (Object) j_del
- - (Object) map(param_1 = nil)
- - (Object) result
- - (Object) set_handler
- - (Boolean) succeeded?

## Constructor Details

### - (`Future`) initialize(j_del)

Returns a new instance of Future

    9
    10
    11
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/future.rb', line 9

    def initialize(j_del)
      @j_del = j_del
    end

## Class Method Details

### + (`Object`) failed_future(failureMessage = nil)

Raises:

- (`ArgumentError`)

    39
    40
    41
    42
    43
    44
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/future.rb', line 39

    def self.failed_future(failureMessage=nil)
      if failureMessage.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::Future.java_method(:failedFuture, [Java::java.lang.String.java_class]).call(failureMessage),::Vertx::Future)
      end
      raise ArgumentError, "Invalid arguments when calling failed_future(failureMessage)"
    end

### + (`Object`) future

Raises:

- (`ArgumentError`)

    19
    20
    21
    22
    23
    24
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/future.rb', line 19

    def self.future
      if !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::Future.java_method(:future, []).call(),::Vertx::Future)
      end
      raise ArgumentError, "Invalid arguments when calling future()"
    end

### + (`Object`) succeeded_future(result = nil)

Raises:

- (`ArgumentError`)

    28
    29
    30
    31
    32
    33
    34
    35
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/future.rb', line 28

    def self.succeeded_future(result=nil)
      if !block_given? && result == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::Future.java_method(:succeededFuture, []).call(),::Vertx::Future)
      elsif (result.class == String  || result.class == Hash || result.class == Array || result.class == NilClass || result.class == TrueClass || result.class == FalseClass || result.class == Fixnum || result.class == Float) && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::Future.java_method(:succeededFuture, [Java::java.lang.Object.java_class]).call(::Vertx::Util::Utils.to_object(result)),::Vertx::Future)
      end
      raise ArgumentError, "Invalid arguments when calling succeeded_future(result)"
    end

## Instance Method Details

### - (`Object`) cause

Raises:

- (`ArgumentError`)

    103
    104
    105
    106
    107
    108
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/future.rb', line 103

    def cause
      if !block_given?
        return ::Vertx::Util::Utils.from_throwable(@j_del.java_method(:cause, []).call())
      end
      raise ArgumentError, "Invalid arguments when calling cause()"
    end

### - (`Object`) complete(result = nil)

Raises:

- (`ArgumentError`)

    71
    72
    73
    74
    75
    76
    77
    78
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/future.rb', line 71

    def complete(result=nil)
      if !block_given? && result == nil
        return @j_del.java_method(:complete, []).call()
      elsif (result.class == String  || result.class == Hash || result.class == Array || result.class == NilClass || result.class == TrueClass || result.class == FalseClass || result.class == Fixnum || result.class == Float) && !block_given?
        return @j_del.java_method(:complete, [Java::java.lang.Object.java_class]).call(::Vertx::Util::Utils.to_object(result))
      end
      raise ArgumentError, "Invalid arguments when calling complete(result)"
    end

### - (`Boolean`) complete?

Returns:

- (`Boolean`)

Raises:

- (`ArgumentError`)

    49
    50
    51
    52
    53
    54
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/future.rb', line 49

    def complete?
      if !block_given?
        return @j_del.java_method(:isComplete, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling complete?()"
    end

### - (`Object`) completer

Raises:

- (`ArgumentError`)

    167
    168
    169
    170
    171
    172
    173
    174
    175
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/future.rb', line 167

    def completer
      if !block_given?
        if @cached_completer != nil
          return @cached_completer
        end
        return @cached_completer = ::Vertx::Util::Utils.to_async_result_handler_proc(@j_del.java_method(:completer, []).call()) { |val| ::Vertx::Util::Utils.to_object(val) }
      end
      raise ArgumentError, "Invalid arguments when calling completer()"
    end

### - (`Object`) compose(param_1 = nil, param_2 = nil)

Raises:

- (`ArgumentError`)

    140
    141
    142
    143
    144
    145
    146
    147
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/future.rb', line 140

    def compose(param_1=nil,param_2=nil)
      if block_given? && param_1 == nil && param_2 == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:compose, [Java::JavaUtilFunction::Function.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_object(event)).j_del })),::Vertx::Future)
      elsif param_1.class == Proc && param_2.class.method_defined?(:j_del) && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:compose, [Java::IoVertxCore::Handler.java_class,Java::IoVertxCore::Future.java_class]).call((Proc.new { |event| param_1.call(::Vertx::Util::Utils.from_object(event)) }),param_2.j_del),::Vertx::Future)
      end
      raise ArgumentError, "Invalid arguments when calling compose(param_1,param_2)"
    end

### - (`Object`) fail(param_1 = nil)

Raises:

- (`ArgumentError`)

    85
    86
    87
    88
    89
    90
    91
    92
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/future.rb', line 85

    def fail(param_1=nil)
      if param_1.is_a?(Exception) && !block_given?
        return @j_del.java_method(:fail, [Java::JavaLang::Throwable.java_class]).call(::Vertx::Util::Utils.to_throwable(param_1))
      elsif param_1.class == String && !block_given?
        return @j_del.java_method(:fail, [Java::java.lang.String.java_class]).call(param_1)
      end
      raise ArgumentError, "Invalid arguments when calling fail(param_1)"
    end

### - (`Boolean`) failed?

Returns:

- (`Boolean`)

Raises:

- (`ArgumentError`)

    119
    120
    121
    122
    123
    124
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/future.rb', line 119

    def failed?
      if !block_given?
        return @j_del.java_method(:failed, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling failed?()"
    end

### - (`Object`) j_del

    14
    15
    16
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/future.rb', line 14

    def j_del
      @j_del
    end

### - (`Object`) map(param_1 = nil)

Raises:

- (`ArgumentError`)

    158
    159
    160
    161
    162
    163
    164
    165
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/future.rb', line 158

    def map(param_1=nil)
      if block_given? && param_1 == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:map, [Java::JavaUtilFunction::Function.java_class]).call((Proc.new { |event| ::Vertx::Util::Utils.to_object(yield(::Vertx::Util::Utils.from_object(event))) })),::Vertx::Future)
      elsif (param_1.class == String  || param_1.class == Hash || param_1.class == Array || param_1.class == NilClass || param_1.class == TrueClass || param_1.class == FalseClass || param_1.class == Fixnum || param_1.class == Float) && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:map, [Java::java.lang.Object.java_class]).call(::Vertx::Util::Utils.to_object(param_1)),::Vertx::Future)
      end
      raise ArgumentError, "Invalid arguments when calling map(param_1)"
    end

### - (`Object`) result

Raises:

- (`ArgumentError`)

    95
    96
    97
    98
    99
    100
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/future.rb', line 95

    def result
      if !block_given?
        return ::Vertx::Util::Utils.from_object(@j_del.java_method(:result, []).call())
      end
      raise ArgumentError, "Invalid arguments when calling result()"
    end

### - (`Object`) set_handler

Raises:

- (`ArgumentError`)

    61
    62
    63
    64
    65
    66
    67
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/future.rb', line 61

    def set_handler
      if block_given?
        @j_del.java_method(:setHandler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.from_object(ar.result) : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_handler()"
    end

### - (`Boolean`) succeeded?

Returns:

- (`Boolean`)

Raises:

- (`ArgumentError`)

    111
    112
    113
    114
    115
    116
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/future.rb', line 111

    def succeeded?
      if !block_given?
        return @j_del.java_method(:succeeded, []).call()
      end
      raise ArgumentError, "Invalid arguments when calling succeeded?()"
    end