Class: Vertx::AsyncMap

Inherits:
Object
  • Object
show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/async_map.rb

Overview

An asynchronous map.

AsyncMap does not allow null to be used as a key or value.

Instance Method Summary (collapse)

Instance Method Details

- (void) clear { ... }

This method returns an undefined value.

Clear all entries in the map

Yields:

  • called on completion

Raises:

  • (ArgumentError)


108
109
110
111
112
113
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/async_map.rb', line 108

def clear
  if true
    return @j_del.java_method(:clear, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) } unless !block_given?))
  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)


25
26
27
28
29
30
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/async_map.rb', line 25

def get(k=nil)
  if @j_arg_K.accept?(k) && true
    return @j_del.java_method(:get, [Java::java.lang.Object.java_class,Java::IoVertxCore::Handler.java_class]).call(@j_arg_K.unwrap(k),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? @j_arg_V.wrap(ar.result) : nil) } unless !block_given?))
  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)


38
39
40
41
42
43
44
45
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/async_map.rb', line 38

def put(k=nil,v=nil,ttl=nil)
  if @j_arg_K.accept?(k) && @j_arg_V.accept?(v) && true && 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(@j_arg_K.unwrap(k),@j_arg_V.unwrap(v),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) } unless !block_given?))
  elsif @j_arg_K.accept?(k) && @j_arg_V.accept?(v) && ttl.class == Fixnum && true
    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(@j_arg_K.unwrap(k),@j_arg_V.unwrap(v),ttl,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) } unless !block_given?))
  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)


53
54
55
56
57
58
59
60
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/async_map.rb', line 53

def put_if_absent(k=nil,v=nil,ttl=nil)
  if @j_arg_K.accept?(k) && @j_arg_V.accept?(v) && true && 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(@j_arg_K.unwrap(k),@j_arg_V.unwrap(v),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? @j_arg_V.wrap(ar.result) : nil) } unless !block_given?))
  elsif @j_arg_K.accept?(k) && @j_arg_V.accept?(v) && ttl.class == Fixnum && true
    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(@j_arg_K.unwrap(k),@j_arg_V.unwrap(v),ttl,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? @j_arg_V.wrap(ar.result) : nil) } unless !block_given?))
  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)


65
66
67
68
69
70
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/async_map.rb', line 65

def remove(k=nil)
  if @j_arg_K.accept?(k) && true
    return @j_del.java_method(:remove, [Java::java.lang.Object.java_class,Java::IoVertxCore::Handler.java_class]).call(@j_arg_K.unwrap(k),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? @j_arg_V.wrap(ar.result) : nil) } unless !block_given?))
  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)


76
77
78
79
80
81
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/async_map.rb', line 76

def remove_if_present(k=nil,v=nil)
  if @j_arg_K.accept?(k) && @j_arg_V.accept?(v) && true
    return @j_del.java_method(:removeIfPresent, [Java::java.lang.Object.java_class,Java::java.lang.Object.java_class,Java::IoVertxCore::Handler.java_class]).call(@j_arg_K.unwrap(k),@j_arg_V.unwrap(v),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) } unless !block_given?))
  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)


87
88
89
90
91
92
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/async_map.rb', line 87

def replace(k=nil,v=nil)
  if @j_arg_K.accept?(k) && @j_arg_V.accept?(v) && true
    return @j_del.java_method(:replace, [Java::java.lang.Object.java_class,Java::java.lang.Object.java_class,Java::IoVertxCore::Handler.java_class]).call(@j_arg_K.unwrap(k),@j_arg_V.unwrap(v),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? @j_arg_V.wrap(ar.result) : nil) } unless !block_given?))
  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)


99
100
101
102
103
104
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/async_map.rb', line 99

def replace_if_present(k=nil,oldValue=nil,newValue=nil)
  if @j_arg_K.accept?(k) && @j_arg_V.accept?(oldValue) && @j_arg_V.accept?(newValue) && true
    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(@j_arg_K.unwrap(k),@j_arg_V.unwrap(oldValue),@j_arg_V.unwrap(newValue),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? ar.result : nil) } unless !block_given?))
  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)


117
118
119
120
121
122
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/async_map.rb', line 117

def size
  if true
    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) } unless !block_given?))
  end
  raise ArgumentError, "Invalid arguments when calling size()"
end