Class List Method List File List

# Class: VertxWebApiContract::ContainerDeserializer

Inherits:
  Object
  - Object
  - VertxWebApiContract::ContainerDeserializer
  show all
Defined in:
  /Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web-api-contract/container_deserializer.rb

## Overview

Interface that define methods for deserialization of array and objects

## 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)

- - (Array<String>) deserialize_array(serialized = nil)
- - (Hash{String => String}) deserialize_object(serialized = nil)

## Class Method Details

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

Returns:

- (`Boolean`)

    17
    18
    19
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web-api-contract/container_deserializer.rb', line 17

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

### + (`Object`) j_api_type

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

    def self.j_api_type
      @@j_api_type
    end

### + (`Object`) j_class

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

    def self.j_class
      Java::IoVertxExtWebApiValidation::ContainerDeserializer.java_class
    end

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

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

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

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

    20
    21
    22
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web-api-contract/container_deserializer.rb', line 20

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

## Instance Method Details

### - (`Array<String>`) deserialize_array(serialized = nil)

Parameters:

- serialized (`String`) (defaults to: `nil`)

Returns:

- (`Array<String>`)

Raises:

- (`ArgumentError`)

    34
    35
    36
    37
    38
    39
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web-api-contract/container_deserializer.rb', line 34

    def deserialize_array(serialized=nil)
      if serialized.class == String && !block_given?
        return @j_del.java_method(:deserializeArray, [Java::java.lang.String.java_class]).call(serialized).to_a.map { |elt| elt }
      end
      raise ArgumentError, "Invalid arguments when calling deserialize_array(#{serialized})"
    end

### - (`Hash{String => String}`) deserialize_object(serialized = nil)

Parameters:

- serialized (`String`) (defaults to: `nil`)

Returns:

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

Raises:

- (`ArgumentError`)

    42
    43
    44
    45
    46
    47
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx-web-api-contract/container_deserializer.rb', line 42

    def deserialize_object(serialized=nil)
      if serialized.class == String && !block_given?
        return Java::IoVertxLangRuby::Helper.adaptingMap(@j_del.java_method(:deserializeObject, [Java::java.lang.String.java_class]).call(serialized), Proc.new { |val| ::Vertx::Util::Utils.from_object(val) }, Proc.new { |val| ::Vertx::Util::Utils.to_string(val) })
      end
      raise ArgumentError, "Invalid arguments when calling deserialize_object(#{serialized})"
    end