Class List Method List File List

# Class: VertxTcpEventbusBridge::TcpEventBusBridge

Inherits:
  Object
  - Object
  - VertxTcpEventbusBridge::TcpEventBusBridge
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb

## Class Method Summary (collapse)

- + (Object) create(vertx = nil, options = nil, netServerOptions = nil)

## Instance Method Summary (collapse)

- - (Object) close
- - (TcpEventBusBridge) initialize(j_del) constructor
  A new instance of TcpEventBusBridge.
- - (Object) j_del
- - (Object) listen(port = nil, address = nil)

## Constructor Details

### - (`TcpEventBusBridge`) initialize(j_del)

Returns a new instance of TcpEventBusBridge

    9
    10
    11
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 9

    def initialize(j_del)
      @j_del = j_del
    end

## Class Method Details

### + (`Object`) create(vertx = nil, options = nil, netServerOptions = nil)

Raises:

- (`ArgumentError`)

    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 21

    def self.create(vertx=nil,options=nil,netServerOptions=nil)
      if vertx.class.method_defined?(:j_del) && !block_given? && options == nil && netServerOptions == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtEventbusBridgeTcp::TcpEventBusBridge.java_method(:create, [Java::IoVertxCore::Vertx.java_class]).call(vertx.j_del),::VertxTcpEventbusBridge::TcpEventBusBridge)
      elsif vertx.class.method_defined?(:j_del) && options.class == Hash && !block_given? && netServerOptions == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtEventbusBridgeTcp::TcpEventBusBridge.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtBridge::BridgeOptions.java_class]).call(vertx.j_del,Java::IoVertxExtBridge::BridgeOptions.new(::Vertx::Util::Utils.to_json_object(options))),::VertxTcpEventbusBridge::TcpEventBusBridge)
      elsif vertx.class.method_defined?(:j_del) && options.class == Hash && netServerOptions.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtEventbusBridgeTcp::TcpEventBusBridge.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtBridge::BridgeOptions.java_class,Java::IoVertxCoreNet::NetServerOptions.java_class]).call(vertx.j_del,Java::IoVertxExtBridge::BridgeOptions.new(::Vertx::Util::Utils.to_json_object(options)),Java::IoVertxCoreNet::NetServerOptions.new(::Vertx::Util::Utils.to_json_object(netServerOptions))),::VertxTcpEventbusBridge::TcpEventBusBridge)
      end
      raise ArgumentError, "Invalid arguments when calling create(vertx,options,netServerOptions)"
    end

## Instance Method Details

### - (`Object`) close

Raises:

- (`ArgumentError`)

    61
    62
    63
    64
    65
    66
    67
    68
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 61

    def close
      if !block_given?
        return @j_del.java_method(:close, []).call()
      elsif block_given?
        return @j_del.java_method(:close, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling close()"
    end

### - (`Object`) j_del

    14
    15
    16
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 14

    def j_del
      @j_del
    end

### - (`Object`) listen(port = nil, address = nil)

Raises:

- (`ArgumentError`)

    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-tcp-eventbus-bridge/tcp_event_bus_bridge.rb', line 36

    def listen(port=nil,address=nil)
      if !block_given? && port == nil && address == nil
        @j_del.java_method(:listen, []).call()
        return self
      elsif block_given? && port == nil && address == nil
        @j_del.java_method(:listen, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxTcpEventbusBridge::TcpEventBusBridge) : nil) }))
        return self
      elsif port.class == Fixnum && !block_given? && address == nil
        @j_del.java_method(:listen, [Java::int.java_class]).call(port)
        return self
      elsif port.class == Fixnum && address.class == String && !block_given?
        @j_del.java_method(:listen, [Java::int.java_class,Java::java.lang.String.java_class]).call(port,address)
        return self
      elsif port.class == Fixnum && block_given? && address == nil
        @j_del.java_method(:listen, [Java::int.java_class,Java::IoVertxCore::Handler.java_class]).call(port,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxTcpEventbusBridge::TcpEventBusBridge) : nil) }))
        return self
      elsif port.class == Fixnum && address.class == String && block_given?
        @j_del.java_method(:listen, [Java::int.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(port,address,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.safe_create(ar.result,::VertxTcpEventbusBridge::TcpEventBusBridge) : nil) }))
        return self
      end
      raise ArgumentError, "Invalid arguments when calling listen(port,address)"
    end