Interface Headers<K,V,T extends Headers<K,V,T>>
-
- Type Parameters:
K
- the type of the header name.V
- the type of the header value.T
- the type to use for return values when the intention is to returnthis
object.
- All Known Subinterfaces:
Http2Headers
- All Known Implementing Classes:
CharSequenceMap
,DefaultHeaders
,DefaultHeadersImpl
,DefaultHttp2Headers
,EmptyHeaders
,EmptyHttp2Headers
,ReadOnlyHttp2Headers
public interface Headers<K,V,T extends Headers<K,V,T>> extends Iterable<Map.Entry<K,V>>
Common interface forHeaders
which represents a mapping of key to value. Duplicate keys may be allowed by implementations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
add(Headers<? extends K,? extends V,?> headers)
Adds all header names and values ofheaders
to this object.T
add(K name, Iterable<? extends V> values)
Adds new headers with the specifiedname
andvalues
.T
add(K name, V value)
Adds a new header with the specifiedname
andvalue
.T
add(K name, V... values)
Adds new headers with the specifiedname
andvalues
.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 value)
Adds a new header.T
addObject(K name, Object... values)
Adds a new header with the specified name and values.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)
Returnstrue
if a header with thename
exists,false
otherwise.boolean
contains(K name, V value)
Returnstrue
if a header with thename
andvalue
exists,false
otherwise.boolean
containsBoolean(K name, boolean value)
Returnstrue
if a header with the name and value exists.boolean
containsByte(K name, byte value)
Returnstrue
if a header with the name and value exists.boolean
containsChar(K name, char value)
Returnstrue
if a header with the name and value exists.boolean
containsDouble(K name, double value)
Returnstrue
if a header with the name and value exists.boolean
containsFloat(K name, float value)
Returnstrue
if a header with the name and value exists.boolean
containsInt(K name, int value)
Returnstrue
if a header with the name and value exists.boolean
containsLong(K name, long value)
Returnstrue
if a header with the name and value exists.boolean
containsObject(K name, Object value)
Returnstrue
if a header with the name and value exists.boolean
containsShort(K name, short value)
Returnstrue
if a header with the name and value exists.boolean
containsTimeMillis(K name, long value)
Returnstrue
if a header with the name and value exists.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 theboolean
value of a header with the specified name.boolean
getBoolean(K name, boolean defaultValue)
Returns theboolean
value of a header with the specified name.Boolean
getBooleanAndRemove(K name)
Returns theboolean
value of a header with the specifiedname
and removes the header from this object.boolean
getBooleanAndRemove(K name, boolean defaultValue)
Returns theboolean
value of a header with the specifiedname
and removes the header from this object.Byte
getByte(K name)
Returns thebyte
value of a header with the specified name.byte
getByte(K name, byte defaultValue)
Returns thebyte
value of a header with the specified name.Byte
getByteAndRemove(K name)
Returns thebyte
value of a header with the specifiedname
and removes the header from this object.byte
getByteAndRemove(K name, byte defaultValue)
Returns thebyte
value of a header with the specifiedname
and removes the header from this object.Character
getChar(K name)
Returns thechar
value of a header with the specified name.char
getChar(K name, char defaultValue)
Returns thechar
value of a header with the specified name.Character
getCharAndRemove(K name)
Returns thechar
value of a header with the specifiedname
and removes the header from this object.char
getCharAndRemove(K name, char defaultValue)
Returns thechar
value of a header with the specifiedname
and removes the header from this object.Double
getDouble(K name)
Returns thedouble
value of a header with the specified name.double
getDouble(K name, double defaultValue)
Returns thedouble
value of a header with the specified name.Double
getDoubleAndRemove(K name)
Returns thedouble
value of a header with the specifiedname
and removes the header from this object.double
getDoubleAndRemove(K name, double defaultValue)
Returns thedouble
value of a header with the specifiedname
and removes the header from this object.Float
getFloat(K name)
Returns thefloat
value of a header with the specified name.float
getFloat(K name, float defaultValue)
Returns thefloat
value of a header with the specified name.Float
getFloatAndRemove(K name)
Returns thefloat
value of a header with the specifiedname
and removes the header from this object.float
getFloatAndRemove(K name, float defaultValue)
Returns thefloat
value of a header with the specifiedname
and removes the header from this object.Integer
getInt(K name)
Returns theint
value of a header with the specified name.int
getInt(K name, int defaultValue)
Returns theint
value of a header with the specified name.Integer
getIntAndRemove(K name)
Returns theint
value of a header with the specifiedname
and removes the header from this object.int
getIntAndRemove(K name, int defaultValue)
Returns theint
value of a header with the specifiedname
and removes the header from this object.Long
getLong(K name)
Returns thelong
value of a header with the specified name.long
getLong(K name, long defaultValue)
Returns thelong
value of a header with the specified name.Long
getLongAndRemove(K name)
Returns thelong
value of a header with the specifiedname
and removes the header from this object.long
getLongAndRemove(K name, long defaultValue)
Returns thelong
value of a header with the specifiedname
and removes the header from this object.Short
getShort(K name)
Returns theshort
value of a header with the specified name.short
getShort(K name, short defaultValue)
Returns theshort
value of a header with the specified name.Short
getShortAndRemove(K name)
Returns theshort
value of a header with the specifiedname
and removes the header from this object.short
getShortAndRemove(K name, short defaultValue)
Returns theshort
value of a header with the specifiedname
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 specifiedname
in milliseconds and removes the header from this object.long
getTimeMillisAndRemove(K name, long defaultValue)
Returns the value of a header with the specifiedname
in milliseconds and removes the header from this object.boolean
isEmpty()
Iterator<Map.Entry<K,V>>
iterator()
Set<K>
names()
Returns aSet
of all header names in this object.boolean
remove(K name)
Removes all headers with the specifiedname
.T
set(Headers<? extends K,? extends V,?> headers)
Clears the current header entries and copies all header entries of the specifiedheaders
.T
set(K name, Iterable<? extends V> values)
Sets a new header with the specified name and values.T
set(K name, V value)
Sets a header with the specified name and value.T
set(K name, V... values)
Sets a header with the specified name and values.T
setAll(Headers<? extends K,? extends V,?> headers)
Retains all current headers but calls#set(K, V)
for each entry inheaders
.T
setBoolean(K name, boolean value)
Set thename
tovalue
.T
setByte(K name, byte value)
Set thename
tovalue
.T
setChar(K name, char value)
Set thename
tovalue
.T
setDouble(K name, double value)
Set thename
tovalue
.T
setFloat(K name, float value)
Set thename
tovalue
.T
setInt(K name, int value)
Set thename
tovalue
.T
setLong(K name, long value)
Set thename
tovalue
.T
setObject(K name, Iterable<?> values)
Sets a header with the specified name and values.T
setObject(K name, Object value)
Sets a new header.T
setObject(K name, Object... values)
Sets a header with the specified name and values.T
setShort(K name, short value)
Set thename
tovalue
.T
setTimeMillis(K name, long value)
Set thename
tovalue
.int
size()
Returns the number of headers in this object.-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
get
V get(K name)
Returns the 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.- Parameters:
name
- the name of the header to retrieve- Returns:
- the first header value if the header is found.
null
if there's no such header
-
get
V get(K name, V defaultValue)
Returns the 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.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the first header value or
defaultValue
if there is no such header
-
getAndRemove
V getAndRemove(K name)
Returns the value of a header with the specified name and removes it from this object. If there is more than one value for the specified name, the first value in insertion order is returned.- Parameters:
name
- the name of the header to retrieve- Returns:
- the first header value or
null
if there is no such header
-
getAndRemove
V getAndRemove(K name, V defaultValue)
Returns the value of a header with the specified name and removes it from this object. If there is more than one value for the specified name, the first value in insertion order is returned.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the first header value or
defaultValue
if there is no such header
-
getAll
List<V> getAll(K name)
Returns all values for the header with the specified name. The returnedList
can't be modified.
-
getAllAndRemove
List<V> getAllAndRemove(K name)
Returns all values for the header with the specified name and removes them from this object. The returnedList
can't be modified.
-
getBoolean
Boolean getBoolean(K name)
Returns theboolean
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.- Parameters:
name
- the name of the header to retrieve- Returns:
- the
boolean
value of the first value in insertion order ornull
if there is no such value or it can't be converted toboolean
.
-
getBoolean
boolean getBoolean(K name, boolean defaultValue)
Returns theboolean
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.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the
boolean
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted toboolean
.
-
getByte
Byte getByte(K name)
Returns thebyte
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.- Parameters:
name
- the name of the header to retrieve- Returns:
- the
byte
value of the first value in insertion order ornull
if there is no such value or it can't be converted tobyte
.
-
getByte
byte getByte(K name, byte defaultValue)
Returns thebyte
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.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the
byte
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted tobyte
.
-
getChar
Character getChar(K name)
Returns thechar
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.- Parameters:
name
- the name of the header to retrieve- Returns:
- the
char
value of the first value in insertion order ornull
if there is no such value or it can't be converted tochar
.
-
getChar
char getChar(K name, char defaultValue)
Returns thechar
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.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the
char
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted tochar
.
-
getShort
Short getShort(K name)
Returns theshort
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.- Parameters:
name
- the name of the header to retrieve- Returns:
- the
short
value of the first value in insertion order ornull
if there is no such value or it can't be converted toshort
.
-
getShort
short getShort(K name, short defaultValue)
Returns theshort
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.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the
short
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted toshort
.
-
getInt
Integer getInt(K name)
Returns theint
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.- Parameters:
name
- the name of the header to retrieve- Returns:
- the
int
value of the first value in insertion order ornull
if there is no such value or it can't be converted toint
.
-
getInt
int getInt(K name, int defaultValue)
Returns theint
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.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the
int
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted toint
.
-
getLong
Long getLong(K name)
Returns thelong
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.- Parameters:
name
- the name of the header to retrieve- Returns:
- the
long
value of the first value in insertion order ornull
if there is no such value or it can't be converted tolong
.
-
getLong
long getLong(K name, long defaultValue)
Returns thelong
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.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the
long
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted tolong
.
-
getFloat
Float getFloat(K name)
Returns thefloat
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.- Parameters:
name
- the name of the header to retrieve- Returns:
- the
float
value of the first value in insertion order ornull
if there is no such value or it can't be converted tofloat
.
-
getFloat
float getFloat(K name, float defaultValue)
Returns thefloat
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.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the
float
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted tofloat
.
-
getDouble
Double getDouble(K name)
Returns thedouble
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.- Parameters:
name
- the name of the header to retrieve- Returns:
- the
double
value of the first value in insertion order ornull
if there is no such value or it can't be converted todouble
.
-
getDouble
double getDouble(K name, double defaultValue)
Returns thedouble
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.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the
double
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted todouble
.
-
getTimeMillis
Long getTimeMillis(K name)
Returns the value of a header with the specified name in milliseconds. If there is more than one value for the specified name, the first value in insertion order is returned.- Parameters:
name
- the name of the header to retrieve- Returns:
- the milliseconds value of the first value in insertion order or
null
if there is no such value or it can't be converted to milliseconds.
-
getTimeMillis
long getTimeMillis(K name, long defaultValue)
Returns the value of a header with the specified name in milliseconds. If there is more than one value for the specified name, the first value in insertion order is returned.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the milliseconds value of the first value in insertion order or
defaultValue
if there is no such value or it can't be converted to milliseconds.
-
getBooleanAndRemove
Boolean getBooleanAndRemove(K name)
Returns theboolean
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to retrieve- Returns:
- the
boolean
value of the first value in insertion order ornull
if there is no such value or it can't be converted toboolean
.
-
getBooleanAndRemove
boolean getBooleanAndRemove(K name, boolean defaultValue)
Returns theboolean
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to searchdefaultValue
- the default value- Returns:
- the
boolean
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted toboolean
.
-
getByteAndRemove
Byte getByteAndRemove(K name)
Returns thebyte
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to search- Returns:
- the
byte
value of the first value in insertion order ornull
if there is no such value or it can't be converted tobyte
.
-
getByteAndRemove
byte getByteAndRemove(K name, byte defaultValue)
Returns thebyte
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to searchdefaultValue
- the default value- Returns:
- the
byte
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted tobyte
.
-
getCharAndRemove
Character getCharAndRemove(K name)
Returns thechar
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to search- Returns:
- the
char
value of the first value in insertion order ornull
if there is no such value or it can't be converted tochar
.
-
getCharAndRemove
char getCharAndRemove(K name, char defaultValue)
Returns thechar
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to searchdefaultValue
- the default value- Returns:
- the
char
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted tochar
.
-
getShortAndRemove
Short getShortAndRemove(K name)
Returns theshort
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to search- Returns:
- the
short
value of the first value in insertion order ornull
if there is no such value or it can't be converted toshort
.
-
getShortAndRemove
short getShortAndRemove(K name, short defaultValue)
Returns theshort
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to searchdefaultValue
- the default value- Returns:
- the
short
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted toshort
.
-
getIntAndRemove
Integer getIntAndRemove(K name)
Returns theint
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to search- Returns:
- the
int
value of the first value in insertion order ornull
if there is no such value or it can't be converted toint
.
-
getIntAndRemove
int getIntAndRemove(K name, int defaultValue)
Returns theint
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to searchdefaultValue
- the default value- Returns:
- the
int
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted toint
.
-
getLongAndRemove
Long getLongAndRemove(K name)
Returns thelong
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to search- Returns:
- the
long
value of the first value in insertion order ornull
if there is no such value or it can't be converted tolong
.
-
getLongAndRemove
long getLongAndRemove(K name, long defaultValue)
Returns thelong
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to searchdefaultValue
- the default value- Returns:
- the
long
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted tolong
.
-
getFloatAndRemove
Float getFloatAndRemove(K name)
Returns thefloat
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to search- Returns:
- the
float
value of the first value in insertion order ornull
if there is no such value or it can't be converted tofloat
.
-
getFloatAndRemove
float getFloatAndRemove(K name, float defaultValue)
Returns thefloat
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to searchdefaultValue
- the default value- Returns:
- the
float
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted tofloat
.
-
getDoubleAndRemove
Double getDoubleAndRemove(K name)
Returns thedouble
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to search- Returns:
- the
double
value of the first value in insertion order ornull
if there is no such value or it can't be converted todouble
.
-
getDoubleAndRemove
double getDoubleAndRemove(K name, double defaultValue)
Returns thedouble
value of a header with the specifiedname
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 forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to searchdefaultValue
- the default value- Returns:
- the
double
value of the first value in insertion order ordefaultValue
if there is no such value or it can't be converted todouble
.
-
getTimeMillisAndRemove
Long getTimeMillisAndRemove(K name)
Returns the value of a header with the specifiedname
in milliseconds and removes the header from this object. If there is more than one value for the specifiedname
, the first value in insertion order is returned. In any case all values forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to retrieve- Returns:
- the milliseconds value of the first value in insertion order or
null
if there is no such value or it can't be converted to milliseconds.
-
getTimeMillisAndRemove
long getTimeMillisAndRemove(K name, long defaultValue)
Returns the value of a header with the specifiedname
in milliseconds and removes the header from this object. If there is more than one value for the specifiedname
, the first value in insertion order is returned. In any case all values forname
are removed.If an exception occurs during the translation from type
T
all entries withname
may still be removed.- Parameters:
name
- the name of the header to retrievedefaultValue
- the default value- Returns:
- the milliseconds value of the first value in insertion order or
defaultValue
if there is no such value or it can't be converted to milliseconds.
-
contains
boolean contains(K name)
Returnstrue
if a header with thename
exists,false
otherwise.- Parameters:
name
- the header name
-
contains
boolean contains(K name, V value)
Returnstrue
if a header with thename
andvalue
exists,false
otherwise.The
Object.equals(Object)
method is used to test for equality ofvalue
.- Parameters:
name
- the header namevalue
- the header value of the header to find
-
containsObject
boolean containsObject(K name, Object value)
Returnstrue
if a header with the name and value exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if it contains itfalse
otherwise
-
containsBoolean
boolean containsBoolean(K name, boolean value)
Returnstrue
if a header with the name and value exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if it contains itfalse
otherwise
-
containsByte
boolean containsByte(K name, byte value)
Returnstrue
if a header with the name and value exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if it contains itfalse
otherwise
-
containsChar
boolean containsChar(K name, char value)
Returnstrue
if a header with the name and value exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if it contains itfalse
otherwise
-
containsShort
boolean containsShort(K name, short value)
Returnstrue
if a header with the name and value exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if it contains itfalse
otherwise
-
containsInt
boolean containsInt(K name, int value)
Returnstrue
if a header with the name and value exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if it contains itfalse
otherwise
-
containsLong
boolean containsLong(K name, long value)
Returnstrue
if a header with the name and value exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if it contains itfalse
otherwise
-
containsFloat
boolean containsFloat(K name, float value)
Returnstrue
if a header with the name and value exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if it contains itfalse
otherwise
-
containsDouble
boolean containsDouble(K name, double value)
Returnstrue
if a header with the name and value exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if it contains itfalse
otherwise
-
containsTimeMillis
boolean containsTimeMillis(K name, long value)
Returnstrue
if a header with the name and value exists.- Parameters:
name
- the header namevalue
- the header value- Returns:
true
if it contains itfalse
otherwise
-
size
int size()
Returns the number of headers in this object.
-
isEmpty
boolean isEmpty()
-
add
T add(K name, V value)
Adds a new header with the specifiedname
andvalue
.- Parameters:
name
- the name of the headervalue
- the value of the header- Returns:
this
-
add
T add(K name, Iterable<? extends V> values)
Adds new headers with the specifiedname
andvalues
. This method is semantically equivalent tofor (T value : values) { headers.add(name, value); }
- Parameters:
name
- the header namevalues
- the values of the header- Returns:
this
-
add
T add(K name, V... values)
Adds new headers with the specifiedname
andvalues
. This method is semantically equivalent tofor (T value : values) { headers.add(name, value); }
- Parameters:
name
- the header namevalues
- the values of the header- Returns:
this
-
addObject
T addObject(K name, Object value)
Adds a new header. Before thevalue
is added, it's converted to typeT
.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
addObject
T addObject(K name, Iterable<?> values)
Adds a new header with the specified name and values. This method is equivalent tofor (Object v : values) { headers.addObject(name, v); }
- Parameters:
name
- the header namevalues
- the value of the header- Returns:
this
-
addObject
T addObject(K name, Object... values)
Adds a new header with the specified name and values. This method is equivalent tofor (Object v : values) { headers.addObject(name, v); }
- Parameters:
name
- the header namevalues
- the value of the header- Returns:
this
-
addBoolean
T addBoolean(K name, boolean value)
Adds a new header.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
addByte
T addByte(K name, byte value)
Adds a new header.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
addChar
T addChar(K name, char value)
Adds a new header.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
addShort
T addShort(K name, short value)
Adds a new header.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
addInt
T addInt(K name, int value)
Adds a new header.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
addLong
T addLong(K name, long value)
Adds a new header.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
addFloat
T addFloat(K name, float value)
Adds a new header.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
addDouble
T addDouble(K name, double value)
Adds a new header.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
addTimeMillis
T addTimeMillis(K name, long value)
Adds a new header.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
add
T add(Headers<? extends K,? extends V,?> headers)
Adds all header names and values ofheaders
to this object.- Returns:
this
- Throws:
IllegalArgumentException
- ifheaders == this
.
-
set
T set(K name, V value)
Sets a header with the specified name and value. Any existing headers with the same name are overwritten.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
-
set
T set(K name, Iterable<? extends V> values)
Sets a new header with the specified name and values. This method is equivalent tofor (T v : values) { headers.addObject(name, v); }
- Parameters:
name
- the header namevalues
- the value of the header- Returns:
this
-
set
T set(K name, V... values)
Sets a header with the specified name and values. Any existing headers with this name are removed. This method is equivalent to:headers.remove(name); for (T v : values) { headers.add(name, v); }
- Parameters:
name
- the header namevalues
- the value of the header- Returns:
this
-
setObject
T setObject(K name, Object value)
Sets a new header. Any existing headers with this name are removed. Before thevalue
is add, it's converted to typeT
.- Parameters:
name
- the header namevalue
- the value of the header- Returns:
this
- Throws:
NullPointerException
- if eithername
orvalue
before or after its conversion isnull
.
-
setObject
T setObject(K name, Iterable<?> values)
Sets a header with the specified name and values. Any existing headers with this name are removed. This method is equivalent to:headers.remove(name); for (Object v : values) { headers.addObject(name, v); }
- Parameters:
name
- the header namevalues
- the values of the header- Returns:
this
-
setObject
T setObject(K name, Object... values)
Sets a header with the specified name and values. Any existing headers with this name are removed. This method is equivalent to:headers.remove(name); for (Object v : values) { headers.addObject(name, v); }
- Parameters:
name
- the header namevalues
- the values of the header- Returns:
this
-
setBoolean
T setBoolean(K name, boolean value)
Set thename
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- The name to modifyvalue
- The value- Returns:
this
-
setByte
T setByte(K name, byte value)
Set thename
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- The name to modifyvalue
- The value- Returns:
this
-
setChar
T setChar(K name, char value)
Set thename
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- The name to modifyvalue
- The value- Returns:
this
-
setShort
T setShort(K name, short value)
Set thename
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- The name to modifyvalue
- The value- Returns:
this
-
setInt
T setInt(K name, int value)
Set thename
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- The name to modifyvalue
- The value- Returns:
this
-
setLong
T setLong(K name, long value)
Set thename
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- The name to modifyvalue
- The value- Returns:
this
-
setFloat
T setFloat(K name, float value)
Set thename
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- The name to modifyvalue
- The value- Returns:
this
-
setDouble
T setDouble(K name, double value)
Set thename
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- The name to modifyvalue
- The value- Returns:
this
-
setTimeMillis
T setTimeMillis(K name, long value)
Set thename
tovalue
. This will remove all previous values associated withname
.- Parameters:
name
- The name to modifyvalue
- The value- Returns:
this
-
set
T set(Headers<? extends K,? extends V,?> headers)
Clears the current header entries and copies all header entries of the specifiedheaders
.- Returns:
this
-
setAll
T setAll(Headers<? extends K,? extends V,?> headers)
Retains all current headers but calls#set(K, V)
for each entry inheaders
.- Parameters:
headers
- The headers used to#set(K, V)
values in this instance- Returns:
this
-
remove
boolean remove(K name)
Removes all headers with the specifiedname
.- Parameters:
name
- the header name- Returns:
true
if at least one entry has been removed.
-
-