Class: Vertx::AsyncMap
- Inherits:
-
Object
- Object
- Vertx::AsyncMap
- 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)
-
- (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
107 108 109 110 111 112 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/async_map.rb', line 107 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.
24 25 26 27 28 29 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/async_map.rb', line 24 def get(k=nil) if @j_arg_K.accept?(k) && block_given? 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) })) 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.
37 38 39 40 41 42 43 44 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/async_map.rb', line 37 def put(k=nil,v=nil,ttl=nil) if @j_arg_K.accept?(k) && @j_arg_V.accept?(v) && 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(@j_arg_K.unwrap(k),@j_arg_V.unwrap(v),(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) })) elsif @j_arg_K.accept?(k) && @j_arg_V.accept?(v) && 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(@j_arg_K.unwrap(k),@j_arg_V.unwrap(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.
52 53 54 55 56 57 58 59 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/async_map.rb', line 52 def put_if_absent(k=nil,v=nil,ttl=nil) if @j_arg_K.accept?(k) && @j_arg_V.accept?(v) && 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(@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) })) elsif @j_arg_K.accept?(k) && @j_arg_V.accept?(v) && 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(@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) })) 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.
64 65 66 67 68 69 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/async_map.rb', line 64 def remove(k=nil) if @j_arg_K.accept?(k) && block_given? 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) })) 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.
75 76 77 78 79 80 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/async_map.rb', line 75 def remove_if_present(k=nil,v=nil) if @j_arg_K.accept?(k) && @j_arg_V.accept?(v) && 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(@j_arg_K.unwrap(k),@j_arg_V.unwrap(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
86 87 88 89 90 91 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/async_map.rb', line 86 def replace(k=nil,v=nil) if @j_arg_K.accept?(k) && @j_arg_V.accept?(v) && 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(@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) })) 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
98 99 100 101 102 103 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/async_map.rb', line 98 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) && 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(@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) })) 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
116 117 118 119 120 121 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/async_map.rb', line 116 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 |