Constructor and Description |
---|
EmptyHeaders() |
Modifier and Type | Method and Description |
---|---|
T |
add(Headers<? extends K,? extends V,?> headers)
Adds all header names and values of
headers to this object. |
T |
add(K name,
Iterable<? extends V> values)
Adds new headers with the specified
name and values . |
T |
add(K name,
V... values)
Adds new headers with the specified
name and values . |
T |
add(K name,
V value)
Adds a new header with the specified
name and value . |
T |
addBoolean(K name,
boolean value)
Adds a new header.
|
T |
addByte(K name,
byte value)
Adds a new header.
|
T |
addChar(K name,
char value)
Adds a new header.
|
T |
addDouble(K name,
double value)
Adds a new header.
|
T |
addFloat(K name,
float value)
Adds a new header.
|
T |
addInt(K name,
int value)
Adds a new header.
|
T |
addLong(K name,
long value)
Adds a new header.
|
T |
addObject(K name,
Iterable<?> values)
Adds a new header with the specified name and values.
|
T |
addObject(K name,
Object... values)
Adds a new header with the specified name and values.
|
T |
addObject(K name,
Object value)
Adds a new header.
|
T |
addShort(K name,
short value)
Adds a new header.
|
T |
addTimeMillis(K name,
long value)
Adds a new header.
|
T |
clear()
Removes all headers.
|
boolean |
contains(K name)
Returns
true if a header with the name exists, false otherwise. |
boolean |
contains(K name,
V value)
Returns
true if a header with the name and value exists, false otherwise. |
boolean |
containsBoolean(K name,
boolean value)
Returns
true if a header with the name and value exists. |
boolean |
containsByte(K name,
byte value)
Returns
true if a header with the name and value exists. |
boolean |
containsChar(K name,
char value)
Returns
true if a header with the name and value exists. |
boolean |
containsDouble(K name,
double value)
Returns
true if a header with the name and value exists. |
boolean |
containsFloat(K name,
float value)
Returns
true if a header with the name and value exists. |
boolean |
containsInt(K name,
int value)
Returns
true if a header with the name and value exists. |
boolean |
containsLong(K name,
long value)
Returns
true if a header with the name and value exists. |
boolean |
containsObject(K name,
Object value)
Returns
true if a header with the name and value exists. |
boolean |
containsShort(K name,
short value)
Returns
true if a header with the name and value exists. |
boolean |
containsTimeMillis(K name,
long value)
Returns
true if a header with the name and value exists. |
boolean |
equals(Object o) |
V |
get(K name)
Returns the value of a header with the specified name.
|
V |
get(K name,
V defaultValue)
Returns the value of a header with the specified name.
|
List<V> |
getAll(K name)
Returns all values for the header with the specified name.
|
List<V> |
getAllAndRemove(K name)
Returns all values for the header with the specified name and removes them from this object.
|
V |
getAndRemove(K name)
Returns the value of a header with the specified name and removes it from this object.
|
V |
getAndRemove(K name,
V defaultValue)
Returns the value of a header with the specified name and removes it from this object.
|
Boolean |
getBoolean(K name)
Returns the
boolean value of a header with the specified name. |
boolean |
getBoolean(K name,
boolean defaultValue)
Returns the
boolean value of a header with the specified name. |
Boolean |
getBooleanAndRemove(K name)
Returns the
boolean value of a header with the specified name and removes the header from this
object. |
boolean |
getBooleanAndRemove(K name,
boolean defaultValue)
Returns the
boolean value of a header with the specified name and removes the header from this
object. |
Byte |
getByte(K name)
Returns the
byte value of a header with the specified name. |
byte |
getByte(K name,
byte defaultValue)
Returns the
byte value of a header with the specified name. |
Byte |
getByteAndRemove(K name)
Returns the
byte value of a header with the specified name and removes the header from this
object. |
byte |
getByteAndRemove(K name,
byte defaultValue)
Returns the
byte value of a header with the specified name and removes the header from this
object. |
Character |
getChar(K name)
Returns the
char value of a header with the specified name. |
char |
getChar(K name,
char defaultValue)
Returns the
char value of a header with the specified name. |
Character |
getCharAndRemove(K name)
Returns the
char value of a header with the specified name and removes the header from this
object. |
char |
getCharAndRemove(K name,
char defaultValue)
Returns the
char value of a header with the specified name and removes the header from this
object. |
Double |
getDouble(K name)
Returns the
double value of a header with the specified name. |
double |
getDouble(K name,
double defaultValue)
Returns the
double value of a header with the specified name. |
Double |
getDoubleAndRemove(K name)
Returns the
double value of a header with the specified name and removes the header from this
object. |
double |
getDoubleAndRemove(K name,
double defaultValue)
Returns the
double value of a header with the specified name and removes the header from this
object. |
Float |
getFloat(K name)
Returns the
float value of a header with the specified name. |
float |
getFloat(K name,
float defaultValue)
Returns the
float value of a header with the specified name. |
Float |
getFloatAndRemove(K name)
Returns the
float value of a header with the specified name and removes the header from this
object. |
float |
getFloatAndRemove(K name,
float defaultValue)
Returns the
float value of a header with the specified name and removes the header from this
object. |
Integer |
getInt(K name)
Returns the
int value of a header with the specified name. |
int |
getInt(K name,
int defaultValue)
Returns the
int value of a header with the specified name. |
Integer |
getIntAndRemove(K name)
Returns the
int value of a header with the specified name and removes the header from this
object. |
int |
getIntAndRemove(K name,
int defaultValue)
Returns the
int value of a header with the specified name and removes the header from this
object. |
Long |
getLong(K name)
Returns the
long value of a header with the specified name. |
long |
getLong(K name,
long defaultValue)
Returns the
long value of a header with the specified name. |
Long |
getLongAndRemove(K name)
Returns the
long value of a header with the specified name and removes the header from this
object. |
long |
getLongAndRemove(K name,
long defaultValue)
Returns the
long value of a header with the specified name and removes the header from this
object. |
Short |
getShort(K name)
Returns the
short value of a header with the specified name. |
short |
getShort(K name,
short defaultValue)
Returns the
short value of a header with the specified name. |
Short |
getShortAndRemove(K name)
Returns the
short value of a header with the specified name and removes the header from this
object. |
short |
getShortAndRemove(K name,
short defaultValue)
Returns the
short value of a header with the specified name and removes the header from this
object. |
Long |
getTimeMillis(K name)
Returns the value of a header with the specified name in milliseconds.
|
long |
getTimeMillis(K name,
long defaultValue)
Returns the value of a header with the specified name in milliseconds.
|
Long |
getTimeMillisAndRemove(K name)
Returns the value of a header with the specified
name in milliseconds and removes the header from this
object. |
long |
getTimeMillisAndRemove(K name,
long defaultValue)
Returns the value of a header with the specified
name in milliseconds and removes the header from this
object. |
int |
hashCode() |
boolean |
isEmpty()
|
Iterator<Map.Entry<K,V>> |
iterator() |
Set<K> |
names()
Returns a
Set of all header names in this object. |
boolean |
remove(K name)
Removes all headers with the specified
name . |
T |
set(Headers<? extends K,? extends V,?> headers)
Clears the current header entries and copies all header entries of the specified
headers . |
T |
set(K name,
Iterable<? extends V> values)
Sets a new header with the specified name and values.
|
T |
set(K name,
V... values)
Sets a header with the specified name and values.
|
T |
set(K name,
V value)
Sets a header with the specified name and value.
|
T |
setAll(Headers<? extends K,? extends V,?> headers)
Retains all current headers but calls
#set(K, V) for each entry in headers . |
T |
setBoolean(K name,
boolean value)
Set the
name to value . |
T |
setByte(K name,
byte value)
Set the
name to value . |
T |
setChar(K name,
char value)
Set the
name to value . |
T |
setDouble(K name,
double value)
Set the
name to value . |
T |
setFloat(K name,
float value)
Set the
name to value . |
T |
setInt(K name,
int value)
Set the
name to value . |
T |
setLong(K name,
long value)
Set the
name to value . |
T |
setObject(K name,
Iterable<?> values)
Sets a header with the specified name and values.
|
T |
setObject(K name,
Object... values)
Sets a header with the specified name and values.
|
T |
setObject(K name,
Object value)
Sets a new header.
|
T |
setShort(K name,
short value)
Set the
name to value . |
T |
setTimeMillis(K name,
long value)
Set the
name to value . |
int |
size()
Returns the number of headers in this object.
|
String |
toString() |
Iterator<V> |
valueIterator(K name)
Equivalent to
getAll(Object) but no intermediate list is generated. |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public V get(K name)
Headers
public V get(K name, V defaultValue)
Headers
public V getAndRemove(K name)
Headers
public V getAndRemove(K name, V defaultValue)
Headers
public List<V> getAll(K name)
Headers
List
can't be modified.public List<V> getAllAndRemove(K name)
Headers
List
can't be modified.public Boolean getBoolean(K name)
Headers
boolean
value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.public boolean getBoolean(K name, boolean defaultValue)
Headers
boolean
value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.getBoolean
in interface Headers<K,V,T extends Headers<K,V,T>>
name
- the name of the header to retrievedefaultValue
- the default valueboolean
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to boolean
.public Byte getByte(K name)
Headers
byte
value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.public byte getByte(K name, byte defaultValue)
Headers
byte
value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.public Character getChar(K name)
Headers
char
value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.public char getChar(K name, char defaultValue)
Headers
char
value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.public Short getShort(K name)
Headers
short
value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.public short getShort(K name, short defaultValue)
Headers
short
value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.getShort
in interface Headers<K,V,T extends Headers<K,V,T>>
name
- the name of the header to retrievedefaultValue
- the default valueshort
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to short
.public Integer getInt(K name)
Headers
int
value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.public int getInt(K name, int defaultValue)
Headers
int
value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.public Long getLong(K name)
Headers
long
value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.public long getLong(K name, long defaultValue)
Headers
long
value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.public Float getFloat(K name)
Headers
float
value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.public float getFloat(K name, float defaultValue)
Headers
float
value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.getFloat
in interface Headers<K,V,T extends Headers<K,V,T>>
name
- the name of the header to retrievedefaultValue
- the default valuefloat
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to float
.public Double getDouble(K name)
Headers
double
value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.public double getDouble(K name, double defaultValue)
Headers
double
value of a header with the specified name. If there is more than one value for the
specified name, the first value in insertion order is returned.getDouble
in interface Headers<K,V,T extends Headers<K,V,T>>
name
- the name of the header to retrievedefaultValue
- the default valuedouble
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to double
.public Long getTimeMillis(K name)
Headers
public long getTimeMillis(K name, long defaultValue)
Headers
getTimeMillis
in interface Headers<K,V,T extends Headers<K,V,T>>
name
- the name of the header to retrievedefaultValue
- the default valuedefaultValue
if there is no such
value or it can't be converted to milliseconds.public Boolean getBooleanAndRemove(K name)
Headers
boolean
value of a header with the specified name
and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name
are removed.
If an exception occurs during the translation from type T
all entries with name
may still
be removed.
public boolean getBooleanAndRemove(K name, boolean defaultValue)
Headers
boolean
value of a header with the specified name
and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name
are removed.
If an exception occurs during the translation from type T
all entries with name
may still
be removed.
getBooleanAndRemove
in interface Headers<K,V,T extends Headers<K,V,T>>
name
- the name of the header to searchdefaultValue
- the default valueboolean
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to boolean
.public Byte getByteAndRemove(K name)
Headers
byte
value of a header with the specified name
and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name
are removed.
If an exception occurs during the translation from type T
all entries with name
may still
be removed.
public byte getByteAndRemove(K name, byte defaultValue)
Headers
byte
value of a header with the specified name
and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name
are removed.
If an exception occurs during the translation from type T
all entries with name
may still
be removed.
getByteAndRemove
in interface Headers<K,V,T extends Headers<K,V,T>>
name
- the name of the header to searchdefaultValue
- the default valuebyte
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to byte
.public Character getCharAndRemove(K name)
Headers
char
value of a header with the specified name
and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name
are removed.
If an exception occurs during the translation from type T
all entries with name
may still
be removed.
public char getCharAndRemove(K name, char defaultValue)
Headers
char
value of a header with the specified name
and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name
are removed.
If an exception occurs during the translation from type T
all entries with name
may still
be removed.
getCharAndRemove
in interface Headers<K,V,T extends Headers<K,V,T>>
name
- the name of the header to searchdefaultValue
- the default valuechar
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to char
.public Short getShortAndRemove(K name)
Headers
short
value of a header with the specified name
and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name
are removed.
If an exception occurs during the translation from type T
all entries with name
may still
be removed.
public short getShortAndRemove(K name, short defaultValue)
Headers
short
value of a header with the specified name
and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name
are removed.
If an exception occurs during the translation from type T
all entries with name
may still
be removed.
getShortAndRemove
in interface Headers<K,V,T extends Headers<K,V,T>>
name
- the name of the header to searchdefaultValue
- the default valueshort
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to short
.public Integer getIntAndRemove(K name)
Headers
int
value of a header with the specified name
and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name
are removed.
If an exception occurs during the translation from type T
all entries with name
may still
be removed.
public int getIntAndRemove(K name, int defaultValue)
Headers
int
value of a header with the specified name
and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name
are removed.
If an exception occurs during the translation from type T
all entries with name
may still
be removed.
getIntAndRemove
in interface Headers<K,V,T extends Headers<K,V,T>>
name
- the name of the header to searchdefaultValue
- the default valueint
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to int
.public Long getLongAndRemove(K name)
Headers
long
value of a header with the specified name
and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name
are removed.
If an exception occurs during the translation from type T
all entries with name
may still
be removed.
public long getLongAndRemove(K name, long defaultValue)
Headers
long
value of a header with the specified name
and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name
are removed.
If an exception occurs during the translation from type T
all entries with name
may still
be removed.
getLongAndRemove
in interface Headers<K,V,T extends Headers<K,V,T>>
name
- the name of the header to searchdefaultValue
- the default valuelong
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to long
.public Float getFloatAndRemove(K name)
Headers
float
value of a header with the specified name
and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name
are removed.
If an exception occurs during the translation from type T
all entries with name
may still
be removed.
public float getFloatAndRemove(K name, float defaultValue)
Headers
float
value of a header with the specified name
and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name
are removed.
If an exception occurs during the translation from type T
all entries with name
may still
be removed.
getFloatAndRemove
in interface Headers<K,V,T extends Headers<K,V,T>>
name
- the name of the header to searchdefaultValue
- the default valuefloat
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to float
.public Double getDoubleAndRemove(K name)
Headers
double
value of a header with the specified name
and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name
are removed.
If an exception occurs during the translation from type T
all entries with name
may still
be removed.
public double getDoubleAndRemove(K name, double defaultValue)
Headers
double
value of a header with the specified name
and removes the header from this
object. If there is more than one value for the specified name, the first value in insertion order is returned.
In any case all values for name
are removed.
If an exception occurs during the translation from type T
all entries with name
may still
be removed.
getDoubleAndRemove
in interface Headers<K,V,T extends Headers<K,V,T>>
name
- the name of the header to searchdefaultValue
- the default valuedouble
value of the first value in insertion order or defaultValue
if there is no
such value or it can't be converted to double
.public Long getTimeMillisAndRemove(K name)
Headers
name
in milliseconds and removes the header from this
object. If there is more than one value for the specified name
, the first value in insertion order is
returned. In any case all values for name
are removed.
If an exception occurs during the translation from type T
all entries with name
may still
be removed.
public long getTimeMillisAndRemove(K name, long defaultValue)
Headers
name
in milliseconds and removes the header from this
object. If there is more than one value for the specified name
, the first value in insertion order is
returned. In any case all values for name
are removed.
If an exception occurs during the translation from type T
all entries with name
may still
be removed.
getTimeMillisAndRemove
in interface Headers<K,V,T extends Headers<K,V,T>>
name
- the name of the header to retrievedefaultValue
- the default valuedefaultValue
if there is no such
value or it can't be converted to milliseconds.public boolean contains(K name)
Headers
true
if a header with the name
exists, false
otherwise.public boolean contains(K name, V value)
Headers
true
if a header with the name
and value
exists, false
otherwise.
The Object.equals(Object)
method is used to test for equality of value
.
public boolean containsObject(K name, Object value)
Headers
true
if a header with the name and value exists.public boolean containsBoolean(K name, boolean value)
Headers
true
if a header with the name and value exists.public boolean containsByte(K name, byte value)
Headers
true
if a header with the name and value exists.public boolean containsChar(K name, char value)
Headers
true
if a header with the name and value exists.public boolean containsShort(K name, short value)
Headers
true
if a header with the name and value exists.public boolean containsInt(K name, int value)
Headers
true
if a header with the name and value exists.public boolean containsLong(K name, long value)
Headers
true
if a header with the name and value exists.public boolean containsFloat(K name, float value)
Headers
true
if a header with the name and value exists.public boolean containsDouble(K name, double value)
Headers
true
if a header with the name and value exists.public boolean containsTimeMillis(K name, long value)
Headers
true
if a header with the name and value exists.public int size()
Headers
public boolean isEmpty()
Headers
public T add(K name, V value)
Headers
name
and value
.public T add(K name, Iterable<? extends V> values)
Headers
name
and values
. This method is semantically equivalent to
for (T value : values) { headers.add(name, value); }
public T add(K name, V... values)
Headers
name
and values
. This method is semantically equivalent to
for (T value : values) { headers.add(name, value); }
public T addObject(K name, Object value)
Headers
value
is added, it's converted to type T
.public T addObject(K name, Iterable<?> values)
Headers
for (Object v : values) { headers.addObject(name, v); }
public T addObject(K name, Object... values)
Headers
for (Object v : values) { headers.addObject(name, v); }
public T addBoolean(K name, boolean value)
Headers
public T addByte(K name, byte value)
Headers
public T addChar(K name, char value)
Headers
public T addShort(K name, short value)
Headers
public T addInt(K name, int value)
Headers
public T addLong(K name, long value)
Headers
public T addFloat(K name, float value)
Headers
public T addDouble(K name, double value)
Headers
public T addTimeMillis(K name, long value)
Headers
public T add(Headers<? extends K,? extends V,?> headers)
Headers
headers
to this object.public T set(K name, V value)
Headers
public T set(K name, Iterable<? extends V> values)
Headers
for (T v : values) { headers.addObject(name, v); }
public T set(K name, V... values)
Headers
headers.remove(name); for (T v : values) { headers.add(name, v); }
public T setObject(K name, Object value)
Headers
value
is add, it's
converted to type T
.public T setObject(K name, Iterable<?> values)
Headers
headers.remove(name); for (Object v : values) { headers.addObject(name, v); }
public T setObject(K name, Object... values)
Headers
headers.remove(name); for (Object v : values) { headers.addObject(name, v); }
public T setBoolean(K name, boolean value)
Headers
name
to value
. This will remove all previous values associated with name
.public T setByte(K name, byte value)
Headers
name
to value
. This will remove all previous values associated with name
.public T setChar(K name, char value)
Headers
name
to value
. This will remove all previous values associated with name
.public T setShort(K name, short value)
Headers
name
to value
. This will remove all previous values associated with name
.public T setInt(K name, int value)
Headers
name
to value
. This will remove all previous values associated with name
.public T setLong(K name, long value)
Headers
name
to value
. This will remove all previous values associated with name
.public T setFloat(K name, float value)
Headers
name
to value
. This will remove all previous values associated with name
.public T setDouble(K name, double value)
Headers
name
to value
. This will remove all previous values associated with name
.public T setTimeMillis(K name, long value)
Headers
name
to value
. This will remove all previous values associated with name
.public T set(Headers<? extends K,? extends V,?> headers)
Headers
headers
.public T setAll(Headers<? extends K,? extends V,?> headers)
Headers
#set(K, V)
for each entry in headers
.public boolean remove(K name)
Headers
name
.public T clear()
Headers
Headers.size()
equals 0
.public Iterator<V> valueIterator(K name)
getAll(Object)
but no intermediate list is generated.name
- the name of the header to retrieveIterator
of header values corresponding to name
.Copyright © 2008–2024 The Netty Project. All rights reserved.