/*
* Copyright 2014 Red Hat, Inc.
*
* Red Hat licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.vertx.reactivex.core;
import io.vertx.reactivex.RxHelper;
import io.vertx.reactivex.ObservableHelper;
import io.vertx.reactivex.FlowableHelper;
import io.vertx.reactivex.impl.AsyncResultMaybe;
import io.vertx.reactivex.impl.AsyncResultSingle;
import io.vertx.reactivex.impl.AsyncResultCompletable;
import io.vertx.reactivex.WriteStreamObserver;
import io.vertx.reactivex.WriteStreamSubscriber;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.Iterator;
import java.util.function.Function;
import java.util.stream.Collectors;
import io.vertx.core.Handler;
import io.vertx.core.AsyncResult;
import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;
import io.vertx.lang.rx.RxGen;
import io.vertx.lang.rx.TypeArg;
import io.vertx.lang.rx.MappingIterator;
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.
NOTE: This class has been automatically generated from the original
non RX-ified interface using Vert.x codegen. /**
* This class represents a MultiMap of String keys to a List of String values.
* <p>
* It's useful in Vert.x to represent things in Vert.x like HTTP headers and HTTP parameters which allow
* multiple values for keys.
*
* <p/>
* NOTE: This class has been automatically generated from the {@link io.vertx.core.MultiMap original} non RX-ified interface using Vert.x codegen.
*/
@RxGen(io.vertx.core.MultiMap.class)
public class MultiMap implements Iterable<java.util.Map.Entry<String, String>> {
@Override
public String toString() {
return delegate.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MultiMap that = (MultiMap) o;
return delegate.equals(that.delegate);
}
@Override
public int hashCode() {
return delegate.hashCode();
}
@Override
public Iterator<java.util.Map.Entry<String, String>> iterator() {
return delegate.iterator();
}
public static final TypeArg<MultiMap> __TYPE_ARG = new TypeArg<>( obj -> new MultiMap((io.vertx.core.MultiMap) obj),
MultiMap::getDelegate
);
private final io.vertx.core.MultiMap delegate;
public MultiMap(io.vertx.core.MultiMap delegate) {
this.delegate = delegate;
}
public MultiMap(Object delegate) {
this.delegate = (io.vertx.core.MultiMap)delegate;
}
public io.vertx.core.MultiMap getDelegate() {
return delegate;
}
Create a multi-map implementation with case insensitive keys, for instance it can be used to hold some HTTP headers.
Returns: the multi-map
/**
* Create a multi-map implementation with case insensitive keys, for instance it can be used to hold some HTTP headers.
* @return the multi-map
*/
public static io.vertx.reactivex.core.MultiMap caseInsensitiveMultiMap() {
io.vertx.reactivex.core.MultiMap ret = io.vertx.reactivex.core.MultiMap.newInstance((io.vertx.core.MultiMap)io.vertx.core.MultiMap.caseInsensitiveMultiMap());
return ret;
}
Returns the value of with the specified name. If there are
more than one values for the specified name, the first value is returned.
Params: - name – The name of the header to search
Returns: The first header value or null
if there is no such entry
/**
* Returns the value of with the specified name. If there are
* more than one values for the specified name, the first value is returned.
* @param name The name of the header to search
* @return The first header value or <code>null</code> if there is no such entry
*/
public String get(String name) {
String ret = delegate.get(name);
return ret;
}
Returns the values with the specified name
Params: - name – The name to search
Returns: A immutable List
of values which will be empty if no values are found
/**
* Returns the values with the specified name
* @param name The name to search
* @return A immutable {@link java.util.List} of values which will be empty if no values are found
*/
public List<String> getAll(String name) {
List<String> ret = delegate.getAll(name);
return ret;
}
Checks to see if there is a value with the specified name
Params: - name – The name to search for
Returns: true if at least one entry is found
/**
* Checks to see if there is a value with the specified name
* @param name The name to search for
* @return true if at least one entry is found
*/
public boolean contains(String name) {
boolean ret = delegate.contains(name);
return ret;
}
Check if there is a header with the specified name
and value
.
If caseInsensitive
is true
, value
is compared in a case-insensitive way.
Params: - name – the name to search for
- value – the value to search for
- caseInsensitive –
Returns: true
if at least one entry is found
/**
* Check if there is a header with the specified <code>name</code> and <code>value</code>.
*
* If <code>caseInsensitive</code> is <code>true</code>, <code>value</code> is compared in a case-insensitive way.
* @param name the name to search for
* @param value the value to search for
* @param caseInsensitive
* @return <code>true</code> if at least one entry is found
*/
public boolean contains(String name, String value, boolean caseInsensitive) {
boolean ret = delegate.contains(name, value, caseInsensitive);
return ret;
}
Return true if empty
Returns:
/**
* Return true if empty
* @return
*/
public boolean isEmpty() {
boolean ret = delegate.isEmpty();
return ret;
}
Gets a immutable Set
of all names Returns: A Set
of all names
/**
* Gets a immutable {@link java.util.Set} of all names
* @return A {@link java.util.Set} of all names
*/
public Set<String> names() {
Set<String> ret = delegate.names();
return ret;
}
Adds a new value with the specified name and value.
Params: - name – The name
- value – The value being added
Returns: a reference to this, so the API can be used fluently
/**
* Adds a new value with the specified name and value.
* @param name The name
* @param value The value being added
* @return a reference to this, so the API can be used fluently
*/
public io.vertx.reactivex.core.MultiMap add(String name, String value) {
delegate.add(name, value);
return this;
}
Adds all the entries from another MultiMap to this one
Params: - map –
Returns: a reference to this, so the API can be used fluently
/**
* Adds all the entries from another MultiMap to this one
* @param map
* @return a reference to this, so the API can be used fluently
*/
public io.vertx.reactivex.core.MultiMap addAll(io.vertx.reactivex.core.MultiMap map) {
delegate.addAll(map.getDelegate());
return this;
}
Sets a value
under the specified name
.
If there is an existing header with the same name, it is removed. Setting a null
value removes the entry.
Params: - name – The name
- value – The value
Returns: a reference to this, so the API can be used fluently
/**
* Sets a <code>value</code> under the specified <code>name</code>.
* <p>
* If there is an existing header with the same name, it is removed. Setting a <code>null</code> value removes the entry.
* @param name The name
* @param value The value
* @return a reference to this, so the API can be used fluently
*/
public io.vertx.reactivex.core.MultiMap set(String name, String value) {
delegate.set(name, value);
return this;
}
Cleans this instance.
Params: - map –
Returns: a reference to this, so the API can be used fluently
/**
* Cleans this instance.
* @param map
* @return a reference to this, so the API can be used fluently
*/
public io.vertx.reactivex.core.MultiMap setAll(io.vertx.reactivex.core.MultiMap map) {
delegate.setAll(map.getDelegate());
return this;
}
Removes the value with the given name
Params: - name – The name of the value to remove
Returns: a reference to this, so the API can be used fluently
/**
* Removes the value with the given name
* @param name The name of the value to remove
* @return a reference to this, so the API can be used fluently
*/
public io.vertx.reactivex.core.MultiMap remove(String name) {
delegate.remove(name);
return this;
}
Removes all
Returns: a reference to this, so the API can be used fluently
/**
* Removes all
* @return a reference to this, so the API can be used fluently
*/
public io.vertx.reactivex.core.MultiMap clear() {
delegate.clear();
return this;
}
Return the number of keys.
Returns:
/**
* Return the number of keys.
* @return
*/
public int size() {
int ret = delegate.size();
return ret;
}
public String get(java.lang.CharSequence name) {
String ret = delegate.get(name);
return ret;
}
Like getAll
but accepting a CharSequence
as a parameter
Params: - name –
Returns:
/**
* Like {@link io.vertx.reactivex.core.MultiMap#getAll} but accepting a <code>CharSequence</code> as a parameter
* @param name
* @return
*/
public List<String> getAll(java.lang.CharSequence name) {
List<String> ret = delegate.getAll(name);
return ret;
}
Returns all entries in the multi-map.
Returns: A immutable List
of the name-value entries, which will be empty if no pairs are found
/**
* Returns all entries in the multi-map.
* @return A immutable {@link java.util.List} of the name-value entries, which will be empty if no pairs are found
*/
public List<java.util.Map.Entry<String, String>> entries() {
List<java.util.Map.Entry<String, String>> ret = delegate.entries();
return ret;
}
Like contains
but accepting a CharSequence
as a parameter
Params: - name –
Returns:
/**
* Like {@link io.vertx.reactivex.core.MultiMap#contains} but accepting a <code>CharSequence</code> as a parameter
* @param name
* @return
*/
public boolean contains(java.lang.CharSequence name) {
boolean ret = delegate.contains(name);
return ret;
}
Like contains
but accepting CharSequence
parameters.
Params: - name –
- value –
- caseInsensitive –
Returns:
/**
* Like {@link io.vertx.reactivex.core.MultiMap#contains} but accepting <code>CharSequence</code> parameters.
* @param name
* @param value
* @param caseInsensitive
* @return
*/
public boolean contains(java.lang.CharSequence name, java.lang.CharSequence value, boolean caseInsensitive) {
boolean ret = delegate.contains(name, value, caseInsensitive);
return ret;
}
Like add
but accepting CharSequence
as parameters
Params: - name –
- value –
Returns:
/**
* Like {@link io.vertx.reactivex.core.MultiMap#add} but accepting <code>CharSequence</code> as parameters
* @param name
* @param value
* @return
*/
public io.vertx.reactivex.core.MultiMap add(java.lang.CharSequence name, java.lang.CharSequence value) {
delegate.add(name, value);
return this;
}
Adds a new values under the specified name
Params: - name – The name being set
- values – The values
Returns: a reference to this, so the API can be used fluently
/**
* Adds a new values under the specified name
* @param name The name being set
* @param values The values
* @return a reference to this, so the API can be used fluently
*/
public io.vertx.reactivex.core.MultiMap add(String name, java.lang.Iterable<String> values) {
delegate.add(name, values);
return this;
}
Like add
but accepting CharSequence
as parameters
Params: - name –
- values –
Returns:
/**
* Like {@link io.vertx.reactivex.core.MultiMap#add} but accepting <code>CharSequence</code> as parameters
* @param name
* @param values
* @return
*/
public io.vertx.reactivex.core.MultiMap add(java.lang.CharSequence name, java.lang.Iterable<java.lang.CharSequence> values) {
delegate.add(name, values);
return this;
}
Adds all the entries from a Map to this
Params: - headers –
Returns: a reference to this, so the API can be used fluently
/**
* Adds all the entries from a Map to this
* @param headers
* @return a reference to this, so the API can be used fluently
*/
public io.vertx.reactivex.core.MultiMap addAll(java.util.Map<String, String> headers) {
delegate.addAll(headers);
return this;
}
Like set
but accepting CharSequence
as parameters
Params: - name –
- value –
Returns:
/**
* Like {@link io.vertx.reactivex.core.MultiMap#set} but accepting <code>CharSequence</code> as parameters
* @param name
* @param value
* @return
*/
public io.vertx.reactivex.core.MultiMap set(java.lang.CharSequence name, java.lang.CharSequence value) {
delegate.set(name, value);
return this;
}
Sets values for the specified name.
Params: - name – The name of the headers being set
- values – The values of the headers being set
Returns: a reference to this, so the API can be used fluently
/**
* Sets values for the specified name.
* @param name The name of the headers being set
* @param values The values of the headers being set
* @return a reference to this, so the API can be used fluently
*/
public io.vertx.reactivex.core.MultiMap set(String name, java.lang.Iterable<String> values) {
delegate.set(name, values);
return this;
}
Like set
but accepting CharSequence
as parameters
Params: - name –
- values –
Returns:
/**
* Like {@link io.vertx.reactivex.core.MultiMap#set} but accepting <code>CharSequence</code> as parameters
* @param name
* @param values
* @return
*/
public io.vertx.reactivex.core.MultiMap set(java.lang.CharSequence name, java.lang.Iterable<java.lang.CharSequence> values) {
delegate.set(name, values);
return this;
}
Cleans and set all values of the given instance
Params: - headers –
Returns: a reference to this, so the API can be used fluently
/**
* Cleans and set all values of the given instance
* @param headers
* @return a reference to this, so the API can be used fluently
*/
public io.vertx.reactivex.core.MultiMap setAll(java.util.Map<String, String> headers) {
delegate.setAll(headers);
return this;
}
Like remove
but accepting CharSequence
as parameters
Params: - name –
Returns:
/**
* Like {@link io.vertx.reactivex.core.MultiMap#remove} but accepting <code>CharSequence</code> as parameters
* @param name
* @return
*/
public io.vertx.reactivex.core.MultiMap remove(java.lang.CharSequence name) {
delegate.remove(name);
return this;
}
public static MultiMap newInstance(io.vertx.core.MultiMap arg) {
return arg != null ? new MultiMap(arg) : null;
}
}