Class: Vertx::MultiMap
- Inherits:
-
Object
- Object
- Vertx::MultiMap
- Defined in:
- /Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/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.
Constant Summary
- @@j_api_type =
Object.new
Class Method Summary (collapse)
- + (Boolean) accept?(obj)
-
+ (::Vertx::MultiMap) caseInsensitiveMultiMap
Create a multi-map implementation with case insensitive keys, for instance it can be used to hold some HTTP headers.
- + (Object) j_api_type
- + (Object) j_class
- + (Object) unwrap(obj)
- + (Object) wrap(obj)
Instance Method Summary (collapse)
-
- (self) add(name, value)
Adds a new value with the specified name and value.
-
- (self) addAll(map)
Adds all the entries from another MultiMap to this one.
-
- (self) clear
Removes all.
-
- (true, false) contains?(*args)
Check if there is a header with the specified name and value.
-
- (true, false) isEmpty
Return true if empty.
-
- (String) get(name)
Returns the value of with the specified name.
-
- (Array<String>) getAll(name)
Returns the values with the specified name.
-
- (Set<String>) names
Gets a immutable Set of all names.
-
- (self) remove(name)
Removes the value with the given name.
-
- (self) set(name, value)
Sets a value under the specified name.
-
- (self) setAll(map)
Cleans this instance.
-
- (Fixnum) size
Return the number of keys.
Class Method Details
+ (Boolean) accept?(obj)
21 22 23 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/multi_map.rb', line 21 def @@j_api_type.accept?(obj) obj.class == MultiMap end |
+ (::Vertx::MultiMap) caseInsensitiveMultiMap
Create a multi-map implementation with case insensitive keys, for instance it can be used to hold some HTTP headers.
207 208 209 210 211 212 213 214 215 216 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/multi_map.rb', line 207 def self.case_insensitive_multi_map if !block_given? return ::Vertx::Util::Utils.safe_create(Java::IoVertxCore::MultiMap.java_method(:caseInsensitiveMultiMap, []).call(),::Vertx::MultiMap) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling case_insensitive_multi_map()" end end |
+ (Object) j_api_type
30 31 32 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/multi_map.rb', line 30 def self.j_api_type @@j_api_type end |
+ (Object) j_class
33 34 35 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/multi_map.rb', line 33 def self.j_class Java::IoVertxCore::MultiMap.java_class end |
+ (Object) unwrap(obj)
27 28 29 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/multi_map.rb', line 27 def @@j_api_type.unwrap(obj) obj.j_del end |
+ (Object) wrap(obj)
24 25 26 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/multi_map.rb', line 24 def @@j_api_type.wrap(obj) MultiMap.new(obj) end |
Instance Method Details
- (self) add(name, value)
Adds a new value with the specified name and value.
41 42 43 44 45 46 47 48 49 50 51 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/multi_map.rb', line 41 def add(*args) if args[0].class == String && args[1].class == String && !block_given? @j_del.java_method(:add, [Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(args[0],args[1]) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling add(#{args[0]},#{args[1]})" end end |
- (self) addAll(map)
Adds all the entries from another MultiMap to this one
136 137 138 139 140 141 142 143 144 145 146 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/multi_map.rb', line 136 def add_all(*args) if args[0].class.method_defined?(:j_del) && !block_given? @j_del.java_method(:addAll, [Java::IoVertxCore::MultiMap.java_class]).call(args[0].j_del) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling add_all(#{args[0]})" end end |
- (self) clear
Removes all
165 166 167 168 169 170 171 172 173 174 175 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/multi_map.rb', line 165 def clear if !block_given? @j_del.java_method(:clear, []).call() return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling clear()" end end |
- (true, false) contains(name) - (true, false) contains(name, value, caseInsensitive)
Check if there is a header with the specified
name
and value
.
If caseInsensitive
is true
, value
is compared in a case-insensitive way.
62 63 64 65 66 67 68 69 70 71 72 73 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/multi_map.rb', line 62 def contains?(*args) if args[0].class == String && !block_given? && args[1] == nil && args[2] == nil return @j_del.java_method(:contains, [Java::java.lang.String.java_class]).call(args[0]) elsif args[0].class == String && args[1].class == String && (args[2].class == TrueClass || args[2].class == FalseClass) && !block_given? return @j_del.java_method(:contains, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::boolean.java_class]).call(args[0],args[1],args[2]) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling contains?(#{args[0]},#{args[1]},#{args[2]})" end end |
- (true, false) isEmpty
Return true if empty
179 180 181 182 183 184 185 186 187 188 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/multi_map.rb', line 179 def empty? if !block_given? return @j_del.java_method(:isEmpty, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling empty?()" end end |
- (String) get(name)
Returns the value of with the specified name. If there are
more than one values for the specified name, the first value is returned.
152 153 154 155 156 157 158 159 160 161 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/multi_map.rb', line 152 def get(*args) if args[0].class == String && !block_given? return @j_del.java_method(:get, [Java::java.lang.String.java_class]).call(args[0]) end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling get(#{args[0]})" end end |
- (Array<String>) getAll(name)
Returns the values with the specified name
109 110 111 112 113 114 115 116 117 118 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/multi_map.rb', line 109 def get_all(*args) if args[0].class == String && !block_given? return @j_del.java_method(:getAll, [Java::java.lang.String.java_class]).call(args[0]).to_a.map { |elt| elt } end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling get_all(#{args[0]})" end end |
- (Set<String>) names
Gets a immutable Set of all names
95 96 97 98 99 100 101 102 103 104 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/multi_map.rb', line 95 def names if !block_given? return ::Vertx::Util::Utils.to_set(@j_del.java_method(:names, []).call()).map! { |elt| elt } end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling names()" end end |
- (self) remove(name)
Removes the value with the given name
221 222 223 224 225 226 227 228 229 230 231 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/multi_map.rb', line 221 def remove(*args) if args[0].class == String && !block_given? @j_del.java_method(:remove, [Java::java.lang.String.java_class]).call(args[0]) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling remove(#{args[0]})" end end |
- (self) set(name, value)
Sets a value under the specified name.
If there is an existing header with the same name, it is removed.
81 82 83 84 85 86 87 88 89 90 91 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/multi_map.rb', line 81 def set(*args) if args[0].class == String && args[1].class == String && !block_given? @j_del.java_method(:set, [Java::java.lang.String.java_class,Java::java.lang.String.java_class]).call(args[0],args[1]) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling set(#{args[0]},#{args[1]})" end end |
- (self) setAll(map)
Cleans this instance.
193 194 195 196 197 198 199 200 201 202 203 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/multi_map.rb', line 193 def set_all(*args) if args[0].class.method_defined?(:j_del) && !block_given? @j_del.java_method(:setAll, [Java::IoVertxCore::MultiMap.java_class]).call(args[0].j_del) return self end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling set_all(#{args[0]})" end end |
- (Fixnum) size
Return the number of keys.
122 123 124 125 126 127 128 129 130 131 |
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx/multi_map.rb', line 122 def size if !block_given? return @j_del.java_method(:size, []).call() end if defined?(super) super else raise ArgumentError, "Invalid arguments when calling size()" end end |