Class: Vertx::MultiMap
- Inherits:
-
Object
- Object
- Vertx::MultiMap
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/multi_map.rb
Overview
This class represents a MultiMap of String keys to a List of String values.
It's useful in Vert.x to represent things in Vert.x like HTTP headers and HTTP parameters which allow multiple values for keys.
Instance Method Summary (collapse)
-
- (self) add(name = nil, value = nil)
Adds a new value with the specified name and value.
-
- (self) add_all(map = nil)
Adds all the entries from another MultiMap to this one.
-
- (self) clear
Removes all.
-
- (true, false) contains?(name = nil)
Checks to see if there is a value with the specified name.
-
- (true, false) empty?
Return true if empty.
-
- (String) get(name = nil)
Returns the value of with the specified name.
-
- (Array<String>) get_all(name = nil)
Returns the values with the specified name.
-
- (Set<String>) names
Gets a immutable Set of all names.
-
- (self) remove(name = nil)
Removes the value with the given name.
-
- (self) set(name = nil, value = nil)
Sets a value under the specified name.
-
- (self) set_all(map = nil)
Cleans this instance.
-
- (Fixnum) size
Return the number of keys.
Instance Method Details
- (self) add(name = nil, value = nil)
Adds a new value with the specified name and value.
67 68 69 70 71 72 73 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/multi_map.rb', line 67 def add(name=nil,value=nil) if name.class == String && value.class == String && !block_given? @j_del.java_method(:add, [Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(name,value) return self end raise ArgumentError, "Invalid arguments when calling add(name,value)" end |
- (self) add_all(map = nil)
Adds all the entries from another MultiMap to this one
77 78 79 80 81 82 83 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/multi_map.rb', line 77 def add_all(map=nil) if map.class.method_defined?(:j_del) && !block_given? @j_del.java_method(:addAll, [Java::IoVertxCore::MultiMap.java_class]).call(map.j_del) return self end raise ArgumentError, "Invalid arguments when calling add_all(map)" end |
- (self) clear
Removes all
119 120 121 122 123 124 125 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/multi_map.rb', line 119 def clear if !block_given? @j_del.java_method(:clear, []).call() return self end raise ArgumentError, "Invalid arguments when calling clear()" end |
- (true, false) contains?(name = nil)
Checks to see if there is a value with the specified name
41 42 43 44 45 46 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/multi_map.rb', line 41 def contains?(name=nil) if name.class == String && !block_given? return @j_del.java_method(:contains, [Java::java.lang.String.java_class]).call(name) end raise ArgumentError, "Invalid arguments when calling contains?(name)" end |
- (true, false) empty?
Return true if empty
49 50 51 52 53 54 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/multi_map.rb', line 49 def empty? if !block_given? return @j_del.java_method(:isEmpty, []).call() end raise ArgumentError, "Invalid arguments when calling empty?()" end |
- (String) get(name = nil)
Returns the value of with the specified name. If there are
more than one values for the specified name, the first value is returned.
23 24 25 26 27 28 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/multi_map.rb', line 23 def get(name=nil) if name.class == String && !block_given? return @j_del.java_method(:get, [Java::java.lang.String.java_class]).call(name) end raise ArgumentError, "Invalid arguments when calling get(name)" end |
- (Array<String>) get_all(name = nil)
Returns the values with the specified name
32 33 34 35 36 37 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/multi_map.rb', line 32 def get_all(name=nil) if name.class == String && !block_given? return @j_del.java_method(:getAll, [Java::java.lang.String.java_class]).call(name).to_a.map { |elt| elt } end raise ArgumentError, "Invalid arguments when calling get_all(name)" end |
- (Set<String>) names
Gets a immutable Set of all names
57 58 59 60 61 62 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/multi_map.rb', line 57 def names if !block_given? return ::Vertx::Util::Utils.to_set(@j_del.java_method(:names, []).call()).map! { |elt| elt } end raise ArgumentError, "Invalid arguments when calling names()" end |
- (self) remove(name = nil)
Removes the value with the given name
110 111 112 113 114 115 116 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/multi_map.rb', line 110 def remove(name=nil) if name.class == String && !block_given? @j_del.java_method(:remove, [Java::java.lang.String.java_class]).call(name) return self end raise ArgumentError, "Invalid arguments when calling remove(name)" end |
- (self) set(name = nil, value = nil)
Sets a value under the specified name.
If there is an existing header with the same name, it is removed.
90 91 92 93 94 95 96 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/multi_map.rb', line 90 def set(name=nil,value=nil) if name.class == String && value.class == String && !block_given? @j_del.java_method(:set, [Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(name,value) return self end raise ArgumentError, "Invalid arguments when calling set(name,value)" end |
- (self) set_all(map = nil)
Cleans this instance.
100 101 102 103 104 105 106 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/multi_map.rb', line 100 def set_all(map=nil) if map.class.method_defined?(:j_del) && !block_given? @j_del.java_method(:setAll, [Java::IoVertxCore::MultiMap.java_class]).call(map.j_del) return self end raise ArgumentError, "Invalid arguments when calling set_all(map)" end |
- (Fixnum) size
Return the number of keys.
128 129 130 131 132 133 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/src/main/resources/vertx/multi_map.rb', line 128 def size if !block_given? return @j_del.java_method(:size, []).call() end raise ArgumentError, "Invalid arguments when calling size()" end |