Class List Method List File List

# Class: Vertx::AsyncMap

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

## Overview

An asynchronous map.

## Instance Method Summary (collapse)

- - (void) clear { ... }
  Clear all entries in the map.
- - (void) get(k = nil) { ... }
  Get a value from the map, asynchronously.
- - (void) put(k = nil, v = nil, ttl = nil) { ... }
  Like #put but specifying a time to live for the entry.
- - (void) put_if_absent(k = nil, v = nil, ttl = nil) { ... }
  Link #put_if_absent but specifying a time to live for the entry.
- - (void) remove(k = nil) { ... }
  Remove a value from the map, asynchronously.
- - (void) remove_if_present(k = nil, v = nil) { ... }
  Remove a value from the map, only if entry already exists with same value.
- - (void) replace(k = nil, v = nil) { ... }
  Replace the entry only if it is currently mapped to some value.
- - (void) replace_if_present(k = nil, oldValue = nil, newValue = nil) { ... }
  Replace the entry only if it is currently mapped to a specific value.
- - (void) size { ... }
  Provide the number of entries in the map.

## Instance Method Details

### - (`void`) clear { ... }

This method returns an undefined value.

Clear all entries in the map

Yields:

- called on completion

Raises:

- (`ArgumentError`)

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

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

### - (`void`) get(k = nil) { ... }

This method returns an undefined value.

Get a value from the map, asynchronously.

Parameters:

- k (`Object`) (defaults to: `nil`) —
  the key

Yields:

- - this will be called some time later with the async result.

Raises:

- (`ArgumentError`)

    21
    22
    23
    24
    25
    26
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/async_map.rb', line 21

    def get(k=nil)
      if (k.class == String  || k.class == Hash || k.class == Array || k.class == NilClass || k.class == TrueClass || k.class == FalseClass || k.class == Fixnum || k.class == Float) && block_given?
        return @j_del.java_method(:get, [Java::java.lang.Object.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_object(k),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.from_object(ar.result) : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling get(k)"
    end

### - (`void`) put(k = nil, v = nil, ttl = nil) { ... }

This method returns an undefined value.

Like #put but specifying a time to live for the entry. Entry will expire and get evicted after the ttl.

Parameters:

- k (`Object`) (defaults to: `nil`) —
  the key
- v (`Object`) (defaults to: `nil`) —
  the value
- ttl (`Fixnum`) (defaults to: `nil`) —
  The time to live (in ms) for the entry

Yields:

- the handler

Raises:

- (`ArgumentError`)

    34
    35
    36
    37
    38
    39
    40
    41
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/async_map.rb', line 34

    def put(k=nil,v=nil,ttl=nil)
      if (k.class == String  || k.class == Hash || k.class == Array || k.class == NilClass || k.class == TrueClass || k.class == FalseClass || k.class == Fixnum || k.class == Float) && (v.class == String  || v.class == Hash || v.class == Array || v.class == NilClass || v.class == TrueClass || v.class == FalseClass || v.class == Fixnum || v.class == Float) && block_given? && ttl == nil
        return @j_del.java_method(:put, [Java::java.lang.Object.java_class,Java::java.lang.Object.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_object(k),::Vertx::Util::Utils.to_object(v),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
      elsif (k.class == String  || k.class == Hash || k.class == Array || k.class == NilClass || k.class == TrueClass || k.class == FalseClass || k.class == Fixnum || k.class == Float) && (v.class == String  || v.class == Hash || v.class == Array || v.class == NilClass || v.class == TrueClass || v.class == FalseClass || v.class == Fixnum || v.class == Float) && ttl.class == Fixnum && block_given?
        return @j_del.java_method(:put, [Java::java.lang.Object.java_class,Java::java.lang.Object.java_class,Java::long.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_object(k),::Vertx::Util::Utils.to_object(v),ttl,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling put(k,v,ttl)"
    end

### - (`void`) put_if_absent(k = nil, v = nil, ttl = nil) { ... }

This method returns an undefined value.

Link #put_if_absent but specifying a time to live for the entry. Entry will expire and get evicted after the ttl.

Parameters:

- k (`Object`) (defaults to: `nil`) —
  the key
- v (`Object`) (defaults to: `nil`) —
  the value
- ttl (`Fixnum`) (defaults to: `nil`) —
  The time to live (in ms) for the entry

Yields:

- the handler

Raises:

- (`ArgumentError`)

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

    def put_if_absent(k=nil,v=nil,ttl=nil)
      if (k.class == String  || k.class == Hash || k.class == Array || k.class == NilClass || k.class == TrueClass || k.class == FalseClass || k.class == Fixnum || k.class == Float) && (v.class == String  || v.class == Hash || v.class == Array || v.class == NilClass || v.class == TrueClass || v.class == FalseClass || v.class == Fixnum || v.class == Float) && block_given? && ttl == nil
        return @j_del.java_method(:putIfAbsent, [Java::java.lang.Object.java_class,Java::java.lang.Object.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_object(k),::Vertx::Util::Utils.to_object(v),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.from_object(ar.result) : nil) }))
      elsif (k.class == String  || k.class == Hash || k.class == Array || k.class == NilClass || k.class == TrueClass || k.class == FalseClass || k.class == Fixnum || k.class == Float) && (v.class == String  || v.class == Hash || v.class == Array || v.class == NilClass || v.class == TrueClass || v.class == FalseClass || v.class == Fixnum || v.class == Float) && ttl.class == Fixnum && block_given?
        return @j_del.java_method(:putIfAbsent, [Java::java.lang.Object.java_class,Java::java.lang.Object.java_class,Java::long.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_object(k),::Vertx::Util::Utils.to_object(v),ttl,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.from_object(ar.result) : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling put_if_absent(k,v,ttl)"
    end

### - (`void`) remove(k = nil) { ... }

This method returns an undefined value.

Remove a value from the map, asynchronously.

Parameters:

- k (`Object`) (defaults to: `nil`) —
  the key

Yields:

- - this will be called some time later to signify the value has been removed

Raises:

- (`ArgumentError`)

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

    def remove(k=nil)
      if (k.class == String  || k.class == Hash || k.class == Array || k.class == NilClass || k.class == TrueClass || k.class == FalseClass || k.class == Fixnum || k.class == Float) && block_given?
        return @j_del.java_method(:remove, [Java::java.lang.Object.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_object(k),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.from_object(ar.result) : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling remove(k)"
    end

### - (`void`) remove_if_present(k = nil, v = nil) { ... }

This method returns an undefined value.

Remove a value from the map, only if entry already exists with same value.

Parameters:

- k (`Object`) (defaults to: `nil`) —
  the key
- v (`Object`) (defaults to: `nil`) —
  the value

Yields:

- - this will be called some time later to signify the value has been removed

Raises:

- (`ArgumentError`)

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

    def remove_if_present(k=nil,v=nil)
      if (k.class == String  || k.class == Hash || k.class == Array || k.class == NilClass || k.class == TrueClass || k.class == FalseClass || k.class == Fixnum || k.class == Float) && (v.class == String  || v.class == Hash || v.class == Array || v.class == NilClass || v.class == TrueClass || v.class == FalseClass || v.class == Fixnum || v.class == Float) && block_given?
        return @j_del.java_method(:removeIfPresent, [Java::java.lang.Object.java_class,Java::java.lang.Object.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_object(k),::Vertx::Util::Utils.to_object(v),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling remove_if_present(k,v)"
    end

### - (`void`) replace(k = nil, v = nil) { ... }

This method returns an undefined value.

Replace the entry only if it is currently mapped to some value

Parameters:

- k (`Object`) (defaults to: `nil`) —
  the key
- v (`Object`) (defaults to: `nil`) —
  the new value

Yields:

- the result handler will be passed the previous value

Raises:

- (`ArgumentError`)

    83
    84
    85
    86
    87
    88
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/async_map.rb', line 83

    def replace(k=nil,v=nil)
      if (k.class == String  || k.class == Hash || k.class == Array || k.class == NilClass || k.class == TrueClass || k.class == FalseClass || k.class == Fixnum || k.class == Float) && (v.class == String  || v.class == Hash || v.class == Array || v.class == NilClass || v.class == TrueClass || v.class == FalseClass || v.class == Fixnum || v.class == Float) && block_given?
        return @j_del.java_method(:replace, [Java::java.lang.Object.java_class,Java::java.lang.Object.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_object(k),::Vertx::Util::Utils.to_object(v),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ::Vertx::Util::Utils.from_object(ar.result) : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling replace(k,v)"
    end

### - (`void`) replace_if_present(k = nil, oldValue = nil, newValue = nil) { ... }

This method returns an undefined value.

Replace the entry only if it is currently mapped to a specific value

Parameters:

- k (`Object`) (defaults to: `nil`) —
  the key
- oldValue (`Object`) (defaults to: `nil`) —
  the existing value
- newValue (`Object`) (defaults to: `nil`) —
  the new value

Yields:

- the result handler

Raises:

- (`ArgumentError`)

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

    def replace_if_present(k=nil,oldValue=nil,newValue=nil)
      if (k.class == String  || k.class == Hash || k.class == Array || k.class == NilClass || k.class == TrueClass || k.class == FalseClass || k.class == Fixnum || k.class == Float) && (oldValue.class == String  || oldValue.class == Hash || oldValue.class == Array || oldValue.class == NilClass || oldValue.class == TrueClass || oldValue.class == FalseClass || oldValue.class == Fixnum || oldValue.class == Float) && (newValue.class == String  || newValue.class == Hash || newValue.class == Array || newValue.class == NilClass || newValue.class == TrueClass || newValue.class == FalseClass || newValue.class == Fixnum || newValue.class == Float) && block_given?
        return @j_del.java_method(:replaceIfPresent, [Java::java.lang.Object.java_class,Java::java.lang.Object.java_class,Java::java.lang.Object.java_class,Java::IoVertxCore::Handler.java_class]).call(::Vertx::Util::Utils.to_object(k),::Vertx::Util::Utils.to_object(oldValue),::Vertx::Util::Utils.to_object(newValue),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) }))
      end
      raise ArgumentError, "Invalid arguments when calling replace_if_present(k,oldValue,newValue)"
    end

### - (`void`) size { ... }

This method returns an undefined value.

Provide the number of entries in the map

Yields:

- handler which will receive the number of entries

Raises:

- (`ArgumentError`)

    113
    114
    115
    116
    117
    118
    # File '/Users/julien/java/vertx-stack/stack-docs/target/rb/vertx/async_map.rb', line 113

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