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 returnthisobject.
- All Superinterfaces:
java.lang.Iterable<java.util.Map.Entry<K,V>>
- All Known Subinterfaces:
Http2Headers,Http3Headers,SpdyHeaders,StompHeaders
- All Known Implementing Classes:
CharSequenceMap,DefaultHeaders,DefaultHeadersImpl,DefaultHttp2Headers,DefaultHttp3Headers,DefaultSpdyHeaders,DefaultStompHeaders,EmptyHeaders,EmptyHttp2Headers,ReadOnlyHttp2Headers
public interface Headers<K,V,T extends Headers<K,V,T>> extends java.lang.Iterable<java.util.Map.Entry<K,V>>Common interface forHeaderswhich 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 Tadd(Headers<? extends K,? extends V,?> headers)Adds all header names and values ofheadersto this object.Tadd(K name, java.lang.Iterable<? extends V> values)Adds new headers with the specifiednameandvalues.Tadd(K name, V value)Adds a new header with the specifiednameandvalue.Tadd(K name, V... values)Adds new headers with the specifiednameandvalues.TaddBoolean(K name, boolean value)Adds a new header.TaddByte(K name, byte value)Adds a new header.TaddChar(K name, char value)Adds a new header.TaddDouble(K name, double value)Adds a new header.TaddFloat(K name, float value)Adds a new header.TaddInt(K name, int value)Adds a new header.TaddLong(K name, long value)Adds a new header.TaddObject(K name, java.lang.Iterable<?> values)Adds a new header with the specified name and values.TaddObject(K name, java.lang.Object value)Adds a new header.TaddObject(K name, java.lang.Object... values)Adds a new header with the specified name and values.TaddShort(K name, short value)Adds a new header.TaddTimeMillis(K name, long value)Adds a new header.Tclear()Removes all headers.booleancontains(K name)Returnstrueif a header with thenameexists,falseotherwise.booleancontains(K name, V value)Returnstrueif a header with thenameandvalueexists,falseotherwise.booleancontainsBoolean(K name, boolean value)Returnstrueif a header with the name and value exists.booleancontainsByte(K name, byte value)Returnstrueif a header with the name and value exists.booleancontainsChar(K name, char value)Returnstrueif a header with the name and value exists.booleancontainsDouble(K name, double value)Returnstrueif a header with the name and value exists.booleancontainsFloat(K name, float value)Returnstrueif a header with the name and value exists.booleancontainsInt(K name, int value)Returnstrueif a header with the name and value exists.booleancontainsLong(K name, long value)Returnstrueif a header with the name and value exists.booleancontainsObject(K name, java.lang.Object value)Returnstrueif a header with the name and value exists.booleancontainsShort(K name, short value)Returnstrueif a header with the name and value exists.booleancontainsTimeMillis(K name, long value)Returnstrueif a header with the name and value exists.Vget(K name)Returns the value of a header with the specified name.Vget(K name, V defaultValue)Returns the value of a header with the specified name.java.util.List<V>getAll(K name)Returns all values for the header with the specified name.java.util.List<V>getAllAndRemove(K name)Returns all values for the header with the specified name and removes them from this object.VgetAndRemove(K name)Returns the value of a header with the specified name and removes it from this object.VgetAndRemove(K name, V defaultValue)Returns the value of a header with the specified name and removes it from this object.java.lang.BooleangetBoolean(K name)Returns thebooleanvalue of a header with the specified name.booleangetBoolean(K name, boolean defaultValue)Returns thebooleanvalue of a header with the specified name.java.lang.BooleangetBooleanAndRemove(K name)Returns thebooleanvalue of a header with the specifiednameand removes the header from this object.booleangetBooleanAndRemove(K name, boolean defaultValue)Returns thebooleanvalue of a header with the specifiednameand removes the header from this object.java.lang.BytegetByte(K name)Returns thebytevalue of a header with the specified name.bytegetByte(K name, byte defaultValue)Returns thebytevalue of a header with the specified name.java.lang.BytegetByteAndRemove(K name)Returns thebytevalue of a header with the specifiednameand removes the header from this object.bytegetByteAndRemove(K name, byte defaultValue)Returns thebytevalue of a header with the specifiednameand removes the header from this object.java.lang.CharactergetChar(K name)Returns thecharvalue of a header with the specified name.chargetChar(K name, char defaultValue)Returns thecharvalue of a header with the specified name.java.lang.CharactergetCharAndRemove(K name)Returns thecharvalue of a header with the specifiednameand removes the header from this object.chargetCharAndRemove(K name, char defaultValue)Returns thecharvalue of a header with the specifiednameand removes the header from this object.java.lang.DoublegetDouble(K name)Returns thedoublevalue of a header with the specified name.doublegetDouble(K name, double defaultValue)Returns thedoublevalue of a header with the specified name.java.lang.DoublegetDoubleAndRemove(K name)Returns thedoublevalue of a header with the specifiednameand removes the header from this object.doublegetDoubleAndRemove(K name, double defaultValue)Returns thedoublevalue of a header with the specifiednameand removes the header from this object.java.lang.FloatgetFloat(K name)Returns thefloatvalue of a header with the specified name.floatgetFloat(K name, float defaultValue)Returns thefloatvalue of a header with the specified name.java.lang.FloatgetFloatAndRemove(K name)Returns thefloatvalue of a header with the specifiednameand removes the header from this object.floatgetFloatAndRemove(K name, float defaultValue)Returns thefloatvalue of a header with the specifiednameand removes the header from this object.java.lang.IntegergetInt(K name)Returns theintvalue of a header with the specified name.intgetInt(K name, int defaultValue)Returns theintvalue of a header with the specified name.java.lang.IntegergetIntAndRemove(K name)Returns theintvalue of a header with the specifiednameand removes the header from this object.intgetIntAndRemove(K name, int defaultValue)Returns theintvalue of a header with the specifiednameand removes the header from this object.java.lang.LonggetLong(K name)Returns thelongvalue of a header with the specified name.longgetLong(K name, long defaultValue)Returns thelongvalue of a header with the specified name.java.lang.LonggetLongAndRemove(K name)Returns thelongvalue of a header with the specifiednameand removes the header from this object.longgetLongAndRemove(K name, long defaultValue)Returns thelongvalue of a header with the specifiednameand removes the header from this object.java.lang.ShortgetShort(K name)Returns theshortvalue of a header with the specified name.shortgetShort(K name, short defaultValue)Returns theshortvalue of a header with the specified name.java.lang.ShortgetShortAndRemove(K name)Returns theshortvalue of a header with the specifiednameand removes the header from this object.shortgetShortAndRemove(K name, short defaultValue)Returns theshortvalue of a header with the specifiednameand removes the header from this object.java.lang.LonggetTimeMillis(K name)Returns the value of a header with the specified name in milliseconds.longgetTimeMillis(K name, long defaultValue)Returns the value of a header with the specified name in milliseconds.java.lang.LonggetTimeMillisAndRemove(K name)Returns the value of a header with the specifiednamein milliseconds and removes the header from this object.longgetTimeMillisAndRemove(K name, long defaultValue)Returns the value of a header with the specifiednamein milliseconds and removes the header from this object.booleanisEmpty()java.util.Iterator<java.util.Map.Entry<K,V>>iterator()java.util.Set<K>names()Returns aSetof all header names in this object.booleanremove(K name)Removes all headers with the specifiedname.Tset(Headers<? extends K,? extends V,?> headers)Clears the current header entries and copies all header entries of the specifiedheaders.Tset(K name, java.lang.Iterable<? extends V> values)Sets a new header with the specified name and values.Tset(K name, V value)Sets a header with the specified name and value.Tset(K name, V... values)Sets a header with the specified name and values.TsetAll(Headers<? extends K,? extends V,?> headers)Retains all current headers but calls#set(K, V)for each entry inheaders.TsetBoolean(K name, boolean value)Set thenametovalue.TsetByte(K name, byte value)Set thenametovalue.TsetChar(K name, char value)Set thenametovalue.TsetDouble(K name, double value)Set thenametovalue.TsetFloat(K name, float value)Set thenametovalue.TsetInt(K name, int value)Set thenametovalue.TsetLong(K name, long value)Set thenametovalue.TsetObject(K name, java.lang.Iterable<?> values)Sets a header with the specified name and values.TsetObject(K name, java.lang.Object value)Sets a new header.TsetObject(K name, java.lang.Object... values)Sets a header with the specified name and values.TsetShort(K name, short value)Set thenametovalue.TsetTimeMillis(K name, long value)Set thenametovalue.intsize()Returns the number of headers in this object.
-
-
-
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.
nullif 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
defaultValueif 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
nullif 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
defaultValueif there is no such header
-
getAll
java.util.List<V> getAll(K name)
Returns all values for the header with the specified name. The returnedListcan't be modified.- Parameters:
name- the name of the header to retrieve- Returns:
- a
Listof header values or an emptyListif no values are found.
-
getAllAndRemove
java.util.List<V> getAllAndRemove(K name)
Returns all values for the header with the specified name and removes them from this object. The returnedListcan't be modified.- Parameters:
name- the name of the header to retrieve- Returns:
- a
Listof header values or an emptyListif no values are found.
-
getBoolean
java.lang.Boolean getBoolean(K name)
Returns thebooleanvalue 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
booleanvalue of the first value in insertion order ornullif there is no such value or it can't be converted toboolean.
-
getBoolean
boolean getBoolean(K name, boolean defaultValue)
Returns thebooleanvalue 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
booleanvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted toboolean.
-
getByte
java.lang.Byte getByte(K name)
Returns thebytevalue 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
bytevalue of the first value in insertion order ornullif there is no such value or it can't be converted tobyte.
-
getByte
byte getByte(K name, byte defaultValue)
Returns thebytevalue 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
bytevalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted tobyte.
-
getChar
java.lang.Character getChar(K name)
Returns thecharvalue 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
charvalue of the first value in insertion order ornullif there is no such value or it can't be converted tochar.
-
getChar
char getChar(K name, char defaultValue)
Returns thecharvalue 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
charvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted tochar.
-
getShort
java.lang.Short getShort(K name)
Returns theshortvalue 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
shortvalue of the first value in insertion order ornullif there is no such value or it can't be converted toshort.
-
getShort
short getShort(K name, short defaultValue)
Returns theshortvalue 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
shortvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted toshort.
-
getInt
java.lang.Integer getInt(K name)
Returns theintvalue 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
intvalue of the first value in insertion order ornullif there is no such value or it can't be converted toint.
-
getInt
int getInt(K name, int defaultValue)
Returns theintvalue 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
intvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted toint.
-
getLong
java.lang.Long getLong(K name)
Returns thelongvalue 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
longvalue of the first value in insertion order ornullif there is no such value or it can't be converted tolong.
-
getLong
long getLong(K name, long defaultValue)
Returns thelongvalue 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
longvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted tolong.
-
getFloat
java.lang.Float getFloat(K name)
Returns thefloatvalue 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
floatvalue of the first value in insertion order ornullif there is no such value or it can't be converted tofloat.
-
getFloat
float getFloat(K name, float defaultValue)
Returns thefloatvalue 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
floatvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted tofloat.
-
getDouble
java.lang.Double getDouble(K name)
Returns thedoublevalue 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
doublevalue of the first value in insertion order ornullif there is no such value or it can't be converted todouble.
-
getDouble
double getDouble(K name, double defaultValue)
Returns thedoublevalue 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
doublevalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted todouble.
-
getTimeMillis
java.lang.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
nullif 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
defaultValueif there is no such value or it can't be converted to milliseconds.
-
getBooleanAndRemove
java.lang.Boolean getBooleanAndRemove(K name)
Returns thebooleanvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to retrieve- Returns:
- the
booleanvalue of the first value in insertion order ornullif there is no such value or it can't be converted toboolean.
-
getBooleanAndRemove
boolean getBooleanAndRemove(K name, boolean defaultValue)
Returns thebooleanvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to searchdefaultValue- the default value- Returns:
- the
booleanvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted toboolean.
-
getByteAndRemove
java.lang.Byte getByteAndRemove(K name)
Returns thebytevalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to search- Returns:
- the
bytevalue of the first value in insertion order ornullif there is no such value or it can't be converted tobyte.
-
getByteAndRemove
byte getByteAndRemove(K name, byte defaultValue)
Returns thebytevalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to searchdefaultValue- the default value- Returns:
- the
bytevalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted tobyte.
-
getCharAndRemove
java.lang.Character getCharAndRemove(K name)
Returns thecharvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to search- Returns:
- the
charvalue of the first value in insertion order ornullif there is no such value or it can't be converted tochar.
-
getCharAndRemove
char getCharAndRemove(K name, char defaultValue)
Returns thecharvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to searchdefaultValue- the default value- Returns:
- the
charvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted tochar.
-
getShortAndRemove
java.lang.Short getShortAndRemove(K name)
Returns theshortvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to search- Returns:
- the
shortvalue of the first value in insertion order ornullif there is no such value or it can't be converted toshort.
-
getShortAndRemove
short getShortAndRemove(K name, short defaultValue)
Returns theshortvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to searchdefaultValue- the default value- Returns:
- the
shortvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted toshort.
-
getIntAndRemove
java.lang.Integer getIntAndRemove(K name)
Returns theintvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to search- Returns:
- the
intvalue of the first value in insertion order ornullif there is no such value or it can't be converted toint.
-
getIntAndRemove
int getIntAndRemove(K name, int defaultValue)
Returns theintvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to searchdefaultValue- the default value- Returns:
- the
intvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted toint.
-
getLongAndRemove
java.lang.Long getLongAndRemove(K name)
Returns thelongvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to search- Returns:
- the
longvalue of the first value in insertion order ornullif there is no such value or it can't be converted tolong.
-
getLongAndRemove
long getLongAndRemove(K name, long defaultValue)
Returns thelongvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to searchdefaultValue- the default value- Returns:
- the
longvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted tolong.
-
getFloatAndRemove
java.lang.Float getFloatAndRemove(K name)
Returns thefloatvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to search- Returns:
- the
floatvalue of the first value in insertion order ornullif there is no such value or it can't be converted tofloat.
-
getFloatAndRemove
float getFloatAndRemove(K name, float defaultValue)
Returns thefloatvalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to searchdefaultValue- the default value- Returns:
- the
floatvalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted tofloat.
-
getDoubleAndRemove
java.lang.Double getDoubleAndRemove(K name)
Returns thedoublevalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to search- Returns:
- the
doublevalue of the first value in insertion order ornullif there is no such value or it can't be converted todouble.
-
getDoubleAndRemove
double getDoubleAndRemove(K name, double defaultValue)
Returns thedoublevalue of a header with the specifiednameand 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to searchdefaultValue- the default value- Returns:
- the
doublevalue of the first value in insertion order ordefaultValueif there is no such value or it can't be converted todouble.
-
getTimeMillisAndRemove
java.lang.Long getTimeMillisAndRemove(K name)
Returns the value of a header with the specifiednamein 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay still be removed.- Parameters:
name- the name of the header to retrieve- Returns:
- the milliseconds value of the first value in insertion order or
nullif 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 specifiednamein 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 fornameare removed.If an exception occurs during the translation from type
Tall entries withnamemay 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
defaultValueif there is no such value or it can't be converted to milliseconds.
-
contains
boolean contains(K name)
Returnstrueif a header with thenameexists,falseotherwise.- Parameters:
name- the header name
-
contains
boolean contains(K name, V value)
Returnstrueif a header with thenameandvalueexists,falseotherwise.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, java.lang.Object value)
Returnstrueif a header with the name and value exists.- Parameters:
name- the header namevalue- the header value- Returns:
trueif it contains itfalseotherwise
-
containsBoolean
boolean containsBoolean(K name, boolean value)
Returnstrueif a header with the name and value exists.- Parameters:
name- the header namevalue- the header value- Returns:
trueif it contains itfalseotherwise
-
containsByte
boolean containsByte(K name, byte value)
Returnstrueif a header with the name and value exists.- Parameters:
name- the header namevalue- the header value- Returns:
trueif it contains itfalseotherwise
-
containsChar
boolean containsChar(K name, char value)
Returnstrueif a header with the name and value exists.- Parameters:
name- the header namevalue- the header value- Returns:
trueif it contains itfalseotherwise
-
containsShort
boolean containsShort(K name, short value)
Returnstrueif a header with the name and value exists.- Parameters:
name- the header namevalue- the header value- Returns:
trueif it contains itfalseotherwise
-
containsInt
boolean containsInt(K name, int value)
Returnstrueif a header with the name and value exists.- Parameters:
name- the header namevalue- the header value- Returns:
trueif it contains itfalseotherwise
-
containsLong
boolean containsLong(K name, long value)
Returnstrueif a header with the name and value exists.- Parameters:
name- the header namevalue- the header value- Returns:
trueif it contains itfalseotherwise
-
containsFloat
boolean containsFloat(K name, float value)
Returnstrueif a header with the name and value exists.- Parameters:
name- the header namevalue- the header value- Returns:
trueif it contains itfalseotherwise
-
containsDouble
boolean containsDouble(K name, double value)
Returnstrueif a header with the name and value exists.- Parameters:
name- the header namevalue- the header value- Returns:
trueif it contains itfalseotherwise
-
containsTimeMillis
boolean containsTimeMillis(K name, long value)
Returnstrueif a header with the name and value exists.- Parameters:
name- the header namevalue- the header value- Returns:
trueif it contains itfalseotherwise
-
size
int size()
Returns the number of headers in this object.
-
isEmpty
boolean isEmpty()
-
names
java.util.Set<K> names()
Returns aSetof all header names in this object. The returnedSetcannot be modified.
-
add
T add(K name, V value)
Adds a new header with the specifiednameandvalue.- Parameters:
name- the name of the headervalue- the value of the header- Returns:
this
-
add
T add(K name, java.lang.Iterable<? extends V> values)
Adds new headers with the specifiednameandvalues. 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 specifiednameandvalues. 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, java.lang.Object value)
Adds a new header. Before thevalueis added, it's converted to typeT.- Parameters:
name- the header namevalue- the value of the header- Returns:
this
-
addObject
T addObject(K name, java.lang.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, java.lang.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 ofheadersto this object.- Returns:
this- Throws:
java.lang.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, java.lang.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, java.lang.Object value)
Sets a new header. Any existing headers with this name are removed. Before thevalueis add, it's converted to typeT.- Parameters:
name- the header namevalue- the value of the header- Returns:
this- Throws:
java.lang.NullPointerException- if eithernameorvaluebefore or after its conversion isnull.
-
setObject
T setObject(K name, java.lang.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, java.lang.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 thenametovalue. 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 thenametovalue. 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 thenametovalue. 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 thenametovalue. 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 thenametovalue. 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 thenametovalue. 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 thenametovalue. 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 thenametovalue. 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 thenametovalue. 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:
trueif at least one entry has been removed.
-
-