Class: Vertx::MultiMap

Inherits:
Object
  • Object
show all
Defined in:
src/main/api_shim/core/http.rb

Overview

A map which can hold multiple values for one name / key

Author:

Instance Method Summary (collapse)

Instance Method Details

- (Object) [](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.

Parameters:

  • name
    The name of the header to search

Returns:

  • The first header value or nil if there is no such entry


1087
1088
1089
# File 'src/main/api_shim/core/http.rb', line 1087

def [](name)
  @j_map.get(name)
end

- (Object) []=(name, value)

Set a value with the specified name and value.

Parameters:

  • name
    The name
  • value
    The value being added

Returns:

  • self


1097
1098
1099
1100
# File 'src/main/api_shim/core/http.rb', line 1097

def []=(name, value)
  @j_map.set(name, value)
  self
end

- (Object) _j_map



1181
1182
1183
# File 'src/main/api_shim/core/http.rb', line 1181

def _j_map
  @j_map
end

- (Object) add(name, value)

Adds a new value with the specified name and value.

Parameters:

  • name
    The name
  • value
    The value being added

Returns:

  • self


1134
1135
1136
1137
# File 'src/main/api_shim/core/http.rb', line 1134

def add(name, value)
  @j_map.add(name, value)
  self
end

- (Object) clear

Remove all entries

Returns:

  • self


1171
1172
1173
1174
# File 'src/main/api_shim/core/http.rb', line 1171

def clear
  @j_map.clear()
  self
end

- (Object) contains(name)

Returns true if an entry with the given name was found


1112
1113
1114
# File 'src/main/api_shim/core/http.rb', line 1112

def contains(name)
  @j_map.contains(name)
end

- (Object) each(&hndlr)

Call the handler for each header name and its value. If there are multiple values are stored for a header name it will be called for each of them


1064
1065
1066
1067
1068
1069
1070
1071
# File 'src/main/api_shim/core/http.rb', line 1064

def each(&hndlr)
  names.each do |name|
    values = @j_map.getAll(name)
    for v in values
      hndlr.call(name, v)
    end
  end
end

- (Boolean) empty?

Returns true if the map is empty

Returns:

  • (Boolean)


1117
1118
1119
# File 'src/main/api_shim/core/http.rb', line 1117

def empty?
  @j_map.isEmpty()
end

- (Object) 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.

Parameters:

  • name
    The name of the header to search

Returns:

  • The first header value or nil if there is no such entry


1078
1079
1080
# File 'src/main/api_shim/core/http.rb', line 1078

def get(name)
  @j_map.get(name)
end

- (Array) get_all(name)

Returns the values with the specified name

Parameters:

  • name
    The name to search

Returns:

  • (Array)
    A immutable array of values which will be empty if no values are found


1107
1108
1109
# File 'src/main/api_shim/core/http.rb', line 1107

def get_all(name)
  @j_map.getAll(name).to_a
end

- (Set) names

Return a Set which holds all names of the entries

Returns:

  • (Set)
    The set which holds all names or an empty set if it is empty


1124
1125
1126
# File 'src/main/api_shim/core/http.rb', line 1124

def names
 @j_map.names()
end

- (Object) remove(name)

Remove the values with the given name

Parameters:

  • name
    The name

Returns:

  • self


1163
1164
1165
1166
# File 'src/main/api_shim/core/http.rb', line 1163

def remove(name)
  @j_map.remove(name)
  self
end

- (Object) set(name, value)

Set a value with the specified name and value.

Parameters:

  • name
    The name
  • value
    The value being added

Returns:

  • self


1144
1145
1146
1147
# File 'src/main/api_shim/core/http.rb', line 1144

def set(name, value)
  @j_map.set(name, value)
  self
end

- (Object) set_all(map)

Set a value with the specified name and value.

Parameters:

  • name
    The name
  • value
    The value being added

Returns:

  • self


1154
1155
1156
1157
# File 'src/main/api_shim/core/http.rb', line 1154

def set_all(map)
  @j_map.set(map._j_map)
  self
end

- (Object) size

Return the number of names in this instance


1177
1178
1179
# File 'src/main/api_shim/core/http.rb', line 1177

def size
  @j_map.size()
end