Class List Method List File List

# Class: VertxWeb::BridgeEvent

Inherits:
  VertxBridgeCommon::BaseBridgeEvent
  - Object
  - Vertx::Future
  - VertxBridgeCommon::BaseBridgeEvent
  - VertxWeb::BridgeEvent
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb

## Overview

Represents an event that occurs on the event bus bridge.

Please consult the documentation for a full explanation.

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Instance Method Summary (collapse)

- - (Exception) cause
- - (void) complete(arg0 = nil)
- - (true, false) complete?
- - (Proc) completer
- - (::Vertx::Future) compose(param_1 = nil, param_2 = nil)
- - (void) fail(param_1 = nil)
- - (true, false) failed?
- - (Hash{String => Object}) get_raw_message
- - (::Vertx::Future) map(param_1 = nil)
- - (::Vertx::Future) map_empty
- - (::Vertx::Future) otherwise(param_1 = nil)
- - (::Vertx::Future) otherwise_empty
- - (::Vertx::Future) recover(mapper = nil) { ... }
- - (true, false) result?
- - (self) set_handler { ... }
- - (self) set_raw_message(message = nil)
  Get the raw JSON message for the event.
- - (::VertxWeb::SockJSSocket) socket
  Get the SockJSSocket instance corresponding to the event.
- - (true, false) succeeded?
- - (true, false) try_complete?(arg0 = nil)
- - (true, false) try_fail?(param_1 = nil)
- - (:SOCKET_CREATED, ...) type

### Methods inherited from Vertx::Future

failed_future, future, #result, succeeded_future

## Class Method Details

### + (`Boolean`) accept?(obj)

Returns:

- (`Boolean`)

    23
    24
    25
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 23

    def @@j_api_type.accept?(obj)
      obj.class == BridgeEvent
    end

### + (`Object`) j_api_type

    32
    33
    34
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 32

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

    35
    36
    37
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 35

    def self.j_class
      Java::IoVertxExtWebHandlerSockjs::BridgeEvent.java_class
    end

### + (`Object`) unwrap(obj)

    29
    30
    31
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 29

    def @@j_api_type.unwrap(obj)
      obj.j_del
    end

### + (`Object`) wrap(obj)

    26
    27
    28
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 26

    def @@j_api_type.wrap(obj)
      BridgeEvent.new(obj)
    end

## Instance Method Details

### - (`Exception`) cause

Returns:

- (`Exception`)

Raises:

- (`ArgumentError`)

    108
    109
    110
    111
    112
    113
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 108

    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

### - (`void`) complete(arg0 = nil)

This method returns an undefined value.

Parameters:

- arg0 (`true`, `false`) (defaults to: `nil`)

Raises:

- (`ArgumentError`)

    56
    57
    58
    59
    60
    61
    62
    63
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 56

    def complete(arg0=nil)
      if !block_given? && arg0 == nil
        return @j_del.java_method(:complete, []).call()
      elsif (arg0.class == TrueClass || arg0.class == FalseClass) && !block_given?
        return @j_del.java_method(:complete, [Java::JavaLang::Boolean.java_class]).call(arg0)
      end
      raise ArgumentError, "Invalid arguments when calling complete(#{arg0})"
    end

### - (`true`, `false`) complete?

Returns:

- (`true`, `false`)

Raises:

- (`ArgumentError`)

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

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

### - (`Proc`) completer

Returns:

- (`Proc`)

Raises:

- (`ArgumentError`)

    163
    164
    165
    166
    167
    168
    169
    170
    171
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 163

    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| val }
      end
      raise ArgumentError, "Invalid arguments when calling completer()"
    end

### - (`::Vertx::Future`) compose(mapper) { ... } - (`::Vertx::Future`) compose(handler)

Overloads:

- - (`::Vertx::Future`) compose(mapper) { ... }

  Yields:

- - (`::Vertx::Future`) compose(handler)

  Parameters:

  - handler (`Proc`)
  - _next (`::Vertx::Future`)

Returns:

- (`::Vertx::Future`)

Raises:

- (`ArgumentError`)

    134
    135
    136
    137
    138
    139
    140
    141
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 134

    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(event).j_del })),::Vertx::Future, nil)
      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(event) }),param_2.j_del),::Vertx::Future, nil)
      end
      raise ArgumentError, "Invalid arguments when calling compose(#{param_1},#{param_2})"
    end

### - (`void`) fail(arg0) - (`void`) fail(arg0)

This method returns an undefined value.

Overloads:

- - (`void`) fail(arg0)

  Parameters:

  - arg0 (`Exception`)
- - (`void`) fail(arg0)

  Parameters:

  - arg0 (`String`)

Raises:

- (`ArgumentError`)

    69
    70
    71
    72
    73
    74
    75
    76
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 69

    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

### - (`true`, `false`) failed?

Returns:

- (`true`, `false`)

Raises:

- (`ArgumentError`)

    122
    123
    124
    125
    126
    127
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 122

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

### - (`Hash{String => Object}`) get_raw_message

Returns:

- (`Hash{String => Object}`)

Raises:

- (`ArgumentError`)

    211
    212
    213
    214
    215
    216
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 211

    def get_raw_message
      if !block_given?
        return @j_del.java_method(:getRawMessage, []).call() != nil ? JSON.parse(@j_del.java_method(:getRawMessage, []).call().encode) : nil
      end
      raise ArgumentError, "Invalid arguments when calling get_raw_message()"
    end

### - (`::Vertx::Future`) map(mapper) { ... } - (`::Vertx::Future`) map(value)

Overloads:

- - (`::Vertx::Future`) map(mapper) { ... }

  Yields:

- - (`::Vertx::Future`) map(value)

  Parameters:

  - value (`Object`)

Returns:

- (`::Vertx::Future`)

Raises:

- (`ArgumentError`)

    147
    148
    149
    150
    151
    152
    153
    154
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 147

    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(event)) })),::Vertx::Future, nil)
      elsif ::Vertx::Util::unknown_type.accept?(param_1) && !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, nil)
      end
      raise ArgumentError, "Invalid arguments when calling map(#{param_1})"
    end

### - (`::Vertx::Future`) map_empty

Returns:

- (`::Vertx::Future`)

Raises:

- (`ArgumentError`)

    156
    157
    158
    159
    160
    161
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 156

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

### - (`::Vertx::Future`) otherwise(mapper) { ... } - (`::Vertx::Future`) otherwise(value)

Overloads:

- - (`::Vertx::Future`) otherwise(mapper) { ... }

  Yields:

- - (`::Vertx::Future`) otherwise(value)

  Parameters:

  - value (`true`, `false`)

Returns:

- (`::Vertx::Future`)

Raises:

- (`ArgumentError`)

    185
    186
    187
    188
    189
    190
    191
    192
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 185

    def otherwise(param_1=nil)
      if block_given? && param_1 == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:otherwise, [Java::JavaUtilFunction::Function.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)) })),::Vertx::Future, nil)
      elsif (param_1.class == TrueClass || param_1.class == FalseClass) && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:otherwise, [Java::JavaLang::Boolean.java_class]).call(param_1),::Vertx::Future, nil)
      end
      raise ArgumentError, "Invalid arguments when calling otherwise(#{param_1})"
    end

### - (`::Vertx::Future`) otherwise_empty

Returns:

- (`::Vertx::Future`)

Raises:

- (`ArgumentError`)

    194
    195
    196
    197
    198
    199
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 194

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

### - (`::Vertx::Future`) recover(mapper = nil) { ... }

Yields:

Returns:

- (`::Vertx::Future`)

Raises:

- (`ArgumentError`)

    174
    175
    176
    177
    178
    179
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 174

    def recover(mapper=nil)
      if block_given? && mapper == nil
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:recover, [Java::JavaUtilFunction::Function.java_class]).call((Proc.new { |event| yield(::Vertx::Util::Utils.from_throwable(event)).j_del })),::Vertx::Future, nil)
      end
      raise ArgumentError, "Invalid arguments when calling recover(#{mapper})"
    end

### - (`true`, `false`) result?

Returns:

- (`true`, `false`)

Raises:

- (`ArgumentError`)

    101
    102
    103
    104
    105
    106
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 101

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

### - (`self`) set_handler { ... }

Yields:

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    47
    48
    49
    50
    51
    52
    53
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 47

    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 ? ar.result : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_handler()"
    end

### - (`self`) set_raw_message(message = nil)

Get the raw JSON message for the event. This will be null for SOCKET_CREATED or SOCKET_CLOSED events as there is no message involved.

Parameters:

- message (`Hash{String => Object}`) (defaults to: `nil`) —
  the raw message

Returns:

- (`self`)

Raises:

- (`ArgumentError`)

    221
    222
    223
    224
    225
    226
    227
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 221

    def set_raw_message(message=nil)
      if message.class == Hash && !block_given?
        @j_del.java_method(:setRawMessage, [Java::IoVertxCoreJson::JsonObject.java_class]).call(::Vertx::Util::Utils.to_json_object(message))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling set_raw_message(#{message})"
    end

### - (`::VertxWeb::SockJSSocket`) socket

Get the SockJSSocket instance corresponding to the event

Returns:

- (`::VertxWeb::SockJSSocket`) —
  the SockJSSocket instance

Raises:

- (`ArgumentError`)

    230
    231
    232
    233
    234
    235
    236
    237
    238
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 230

    def socket
      if !block_given?
        if @cached_socket != nil
          return @cached_socket
        end
        return @cached_socket = ::Vertx::Util::Utils.safe_create(@j_del.java_method(:socket, []).call(),::VertxWeb::SockJSSocket)
      end
      raise ArgumentError, "Invalid arguments when calling socket()"
    end

### - (`true`, `false`) succeeded?

Returns:

- (`true`, `false`)

Raises:

- (`ArgumentError`)

    115
    116
    117
    118
    119
    120
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 115

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

### - (`true`, `false`) try_complete?(arg0 = nil)

Parameters:

- arg0 (`true`, `false`) (defaults to: `nil`)

Returns:

- (`true`, `false`)

Raises:

- (`ArgumentError`)

    79
    80
    81
    82
    83
    84
    85
    86
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 79

    def try_complete?(arg0=nil)
      if !block_given? && arg0 == nil
        return @j_del.java_method(:tryComplete, []).call()
      elsif (arg0.class == TrueClass || arg0.class == FalseClass) && !block_given?
        return @j_del.java_method(:tryComplete, [Java::JavaLang::Boolean.java_class]).call(arg0)
      end
      raise ArgumentError, "Invalid arguments when calling try_complete?(#{arg0})"
    end

### - (`true`, `false`) tryFail(arg0) - (`true`, `false`) tryFail(arg0)

Overloads:

- - (`true`, `false`) tryFail(arg0)

  Parameters:

  - arg0 (`Exception`)
- - (`true`, `false`) tryFail(arg0)

  Parameters:

  - arg0 (`String`)

Returns:

- (`true`, `false`)

Raises:

- (`ArgumentError`)

    92
    93
    94
    95
    96
    97
    98
    99
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 92

    def try_fail?(param_1=nil)
      if param_1.is_a?(Exception) && !block_given?
        return @j_del.java_method(:tryFail, [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(:tryFail, [Java::java.lang.String.java_class]).call(param_1)
      end
      raise ArgumentError, "Invalid arguments when calling try_fail?(#{param_1})"
    end

### - (`:SOCKET_CREATED`, ...) type

Returns:

- (`:SOCKET_CREATED`, `:SOCKET_CLOSED`, `:SOCKET_IDLE`, `:SOCKET_PING`, `:SEND`, `:PUBLISH`, `:RECEIVE`, `:REGISTER`, `:UNREGISTER`)

Raises:

- (`ArgumentError`)

    201
    202
    203
    204
    205
    206
    207
    208
    209
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web/bridge_event.rb', line 201

    def type
      if !block_given?
        if @cached_type != nil
          return @cached_type
        end
        return @cached_type = @j_del.java_method(:type, []).call().name.intern
      end
      raise ArgumentError, "Invalid arguments when calling type()"
    end