Class List Method List File List

# Class: VertxStomp::Frames

Inherits:
  Object
  - Object
  - VertxStomp::Frames
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/frames.rb

## Overview

Utility methods to build common Hashs. It defines a non-STOMP frame (`PING`) that is used for heartbeats. When such frame is written on the wire it is just the `0` byte.

This class is thread-safe.

## Constant Summary

@@j_api_type =

      Object.new

## Class Method Summary (collapse)

- + (Boolean) accept?(obj)
- + (Hash) create_error_frame(message = nil, headers = nil, body = nil)
- + (Hash) create_receipt_frame(receiptId = nil, headers = nil)
- + (void) handle_receipt(frame = nil, connection = nil)
- + (Object) j_api_type
- + (Object) j_class
- + (Hash) ping
- + (Object) unwrap(obj)
- + (Object) wrap(obj)

## Class Method Details

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

Returns:

- (`Boolean`)

    21
    22
    23
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/frames.rb', line 21

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

### + (`Hash`) create_error_frame(message = nil, headers = nil, body = nil)

Parameters:

- message (`String`) (defaults to: `nil`)
- headers (`Hash{String => String}`) (defaults to: `nil`)
- body (`String`) (defaults to: `nil`)

Returns:

- (`Hash`)

Raises:

- (`ArgumentError`)

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

    def self.create_error_frame(message=nil,headers=nil,body=nil)
      if message.class == String && headers.class == Hash && body.class == String && !block_given?
        return Java::IoVertxExtStomp::Frames.java_method(:createErrorFrame, [Java::java.lang.String.java_class,Java::JavaUtil::Map.java_class,Java::java.lang.String.java_class]).call(message,Hash[headers.map { |k,v| [k,v] }],body) != nil ? JSON.parse(Java::IoVertxExtStomp::Frames.java_method(:createErrorFrame, [Java::java.lang.String.java_class,Java::JavaUtil::Map.java_class,Java::java.lang.String.java_class]).call(message,Hash[headers.map { |k,v| [k,v] }],body).toJson.encode) : nil
      end
      raise ArgumentError, "Invalid arguments when calling create_error_frame(#{message},#{headers},#{body})"
    end

### + (`Hash`) create_receipt_frame(receiptId = nil, headers = nil)

Parameters:

- receiptId (`String`) (defaults to: `nil`)
- headers (`Hash{String => String}`) (defaults to: `nil`)

Returns:

- (`Hash`)

Raises:

- (`ArgumentError`)

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

    def self.create_receipt_frame(receiptId=nil,headers=nil)
      if receiptId.class == String && headers.class == Hash && !block_given?
        return Java::IoVertxExtStomp::Frames.java_method(:createReceiptFrame, [Java::java.lang.String.java_class,Java::JavaUtil::Map.java_class]).call(receiptId,Hash[headers.map { |k,v| [k,v] }]) != nil ? JSON.parse(Java::IoVertxExtStomp::Frames.java_method(:createReceiptFrame, [Java::java.lang.String.java_class,Java::JavaUtil::Map.java_class]).call(receiptId,Hash[headers.map { |k,v| [k,v] }]).toJson.encode) : nil
      end
      raise ArgumentError, "Invalid arguments when calling create_receipt_frame(#{receiptId},#{headers})"
    end

### + (`void`) handle_receipt(frame = nil, connection = nil)

This method returns an undefined value.

Parameters:

- frame (`Hash`) (defaults to: `nil`)
- connection (`::VertxStomp::StompServerConnection`) (defaults to: `nil`)

Raises:

- (`ArgumentError`)

    58
    59
    60
    61
    62
    63
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/frames.rb', line 58

    def self.handle_receipt(frame=nil,connection=nil)
      if frame.class == Hash && connection.class.method_defined?(:j_del) && !block_given?
        return Java::IoVertxExtStomp::Frames.java_method(:handleReceipt, [Java::IoVertxExtStomp::Frame.java_class,Java::IoVertxExtStomp::StompServerConnection.java_class]).call(Java::IoVertxExtStomp::Frame.new(::Vertx::Util::Utils.to_json_object(frame)),connection.j_del)
      end
      raise ArgumentError, "Invalid arguments when calling handle_receipt(#{frame},#{connection})"
    end

### + (`Object`) j_api_type

    30
    31
    32
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/frames.rb', line 30

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

    33
    34
    35
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/frames.rb', line 33

    def self.j_class
      Java::IoVertxExtStomp::Frames.java_class
    end

### + (`Hash`) ping

Returns:

- (`Hash`)

Raises:

- (`ArgumentError`)

    65
    66
    67
    68
    69
    70
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/frames.rb', line 65

    def self.ping
      if !block_given?
        return Java::IoVertxExtStomp::Frames.java_method(:ping, []).call() != nil ? JSON.parse(Java::IoVertxExtStomp::Frames.java_method(:ping, []).call().toJson.encode) : nil
      end
      raise ArgumentError, "Invalid arguments when calling ping()"
    end

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

    27
    28
    29
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/frames.rb', line 27

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

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

    24
    25
    26
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-stomp/frames.rb', line 24

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