Class DefaultHeaders<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.
- Direct Known Subclasses:
CharSequenceMap,CombinedHttpHeaders.CombinedHttpHeadersImpl,DefaultHeadersImpl,DefaultHttp2Headers,DefaultSpdyHeaders,DefaultStompHeaders
Headers;-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprivate final classstatic interfaceprivate final classstatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final DefaultHeaders.HeaderEntry<K,V>[] (package private) static final intConstant used to seed the hash code generation.private final HashingStrategy<K> private final byteprotected final DefaultHeaders.HeaderEntry<K, V> private final DefaultHeaders.NameValidator<K> (package private) intprivate final ValueConverter<V> private final DefaultHeaders.ValueValidator<V> -
Constructor Summary
ConstructorsConstructorDescriptionDefaultHeaders(ValueConverter<V> valueConverter) DefaultHeaders(ValueConverter<V> valueConverter, DefaultHeaders.NameValidator<K> nameValidator) DefaultHeaders(HashingStrategy<K> nameHashingStrategy, ValueConverter<V> valueConverter) DefaultHeaders(HashingStrategy<K> nameHashingStrategy, ValueConverter<V> valueConverter, DefaultHeaders.NameValidator<K> nameValidator) DefaultHeaders(HashingStrategy<K> nameHashingStrategy, ValueConverter<V> valueConverter, DefaultHeaders.NameValidator<K> nameValidator, int arraySizeHint) Create a new instance.DefaultHeaders(HashingStrategy<K> nameHashingStrategy, ValueConverter<V> valueConverter, DefaultHeaders.NameValidator<K> nameValidator, int arraySizeHint, DefaultHeaders.ValueValidator<V> valueValidator) Create a new instance. -
Method Summary
Modifier and TypeMethodDescriptionAdds all header names and values ofheadersto this object.Adds new headers with the specifiednameandvalues.Adds a new header with the specifiednameandvalue.Adds new headers with the specifiednameandvalues.private voidaddBoolean(K name, boolean value) Adds a new header.Adds a new header.Adds a new header.Adds a new header.Adds a new header.protected voidAdds a new header.Adds a new header.Adds a new header with the specified name and values.Adds a new header.Adds a new header with the specified name and values.Adds a new header.addTimeMillis(K name, long value) Adds a new header.clear()Removes all headers.booleanReturnstrueif a header with thenameexists,falseotherwise.booleanReturnstrueif a header with thenameandvalueexists,falseotherwise.final booleancontains(K name, V value, HashingStrategy<? super V> valueHashingStrategy) 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, 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.copy()Returns a deep copy of this instance.final booleanTest this object for equality againsth2.booleanprivate VfromBoolean(K name, boolean value) private Vprivate Vprivate VfromDouble(K name, double value) private Vprivate Vprivate Vprivate VfromObject(K name, Object value) private Vprivate VfromTimeMillis(K name, long value) Returns the value of a header with the specified name.Returns the value of a header with the specified name.Returns all values for the header with the specified name.getAllAndRemove(K name) Returns all values for the header with the specified name and removes them from this object.getAndRemove(K name) Returns the value of a header with the specified name and removes it from this object.getAndRemove(K name, V defaultValue) Returns the value of a header with the specified name and removes it from this object.getBoolean(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.getBooleanAndRemove(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.Returns thebytevalue of a header with the specified name.byteReturns thebytevalue of a header with the specified name.getByteAndRemove(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.Returns thecharvalue of a header with the specified name.charReturns thecharvalue of a header with the specified name.getCharAndRemove(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.Returns thedoublevalue of a header with the specified name.doubleReturns thedoublevalue of a header with the specified name.getDoubleAndRemove(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.Returns thefloatvalue of a header with the specified name.floatReturns thefloatvalue of a header with the specified name.getFloatAndRemove(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.Returns theintvalue of a header with the specified name.intReturns theintvalue of a header with the specified name.getIntAndRemove(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.Returns thelongvalue of a header with the specified name.longReturns thelongvalue of a header with the specified name.getLongAndRemove(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.Returns theshortvalue of a header with the specified name.shortReturns theshortvalue of a header with the specified name.getShortAndRemove(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.getTimeMillis(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.getTimeMillisAndRemove(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.inthashCode()final inthashCode(HashingStrategy<V> valueHashingStrategy) Generate a hash code for this object given aHashingStrategyto generate hash codes for individual values.private intindex(int hash) booleanisEmpty()iterator()names()Returns aSetof all header names in this object.protected DefaultHeaders.NameValidator<K> protected DefaultHeaders.HeaderEntry<K, V> newHeaderEntry(int h, K name, V value, DefaultHeaders.HeaderEntry<K, V> next) booleanRemoves all headers with the specifiedname.private V(package private) DefaultHeaders.HeaderEntry<K, V> remove0(DefaultHeaders.HeaderEntry<K, V> entry, DefaultHeaders.HeaderEntry<K, V> previous) Clears the current header entries and copies all header entries of the specifiedheaders.Sets a new header with the specified name and values.Sets a header with the specified name and value.Sets a header with the specified name and values.Retains all current headers but callsHeaders.set(K, V)for each entry inheaders.setBoolean(K name, boolean value) Set thenametovalue.Set thenametovalue.Set thenametovalue.Set thenametovalue.Set thenametovalue.Set thenametovalue.Set thenametovalue.Sets a header with the specified name and values.Sets a new header.Sets a header with the specified name and values.Set thenametovalue.setTimeMillis(K name, long value) Set thenametovalue.intsize()Returns the number of headers in this object.private TthisT()private booleanprivate byteprivate charprivate doubleprivate floatprivate intprivate longprivate shorttoString()private longtoTimeMillis(K name, V value) protected voidvalidateName(DefaultHeaders.NameValidator<K> validator, boolean forAdd, K name) Call out to the givenDefaultHeaders.NameValidatorto validate the given name.protected voidvalidateValue(DefaultHeaders.ValueValidator<V> validator, K name, V value) protected ValueConverter<V> valueIterator(K name) Equivalent togetAll(Object)but no intermediate list is generated.protected DefaultHeaders.ValueValidator<V> Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
HASH_CODE_SEED
static final int HASH_CODE_SEEDConstant used to seed the hash code generation. Could be anything but this was borrowed from murmur3.- See Also:
-
entries
-
head
-
hashMask
private final byte hashMask -
valueConverter
-
nameValidator
-
valueValidator
-
hashingStrategy
-
size
int size
-
-
Constructor Details
-
DefaultHeaders
-
DefaultHeaders
public DefaultHeaders(ValueConverter<V> valueConverter, DefaultHeaders.NameValidator<K> nameValidator) -
DefaultHeaders
-
DefaultHeaders
public DefaultHeaders(HashingStrategy<K> nameHashingStrategy, ValueConverter<V> valueConverter, DefaultHeaders.NameValidator<K> nameValidator) -
DefaultHeaders
public DefaultHeaders(HashingStrategy<K> nameHashingStrategy, ValueConverter<V> valueConverter, DefaultHeaders.NameValidator<K> nameValidator, int arraySizeHint) Create a new instance.- Parameters:
nameHashingStrategy- Used to hash and equality compare names.valueConverter- Used to convert values to/from native types.nameValidator- Used to validate name elements.arraySizeHint- A hint as to how large the hash data structure should be. The next positive power of two will be used. An upper bound may be enforced.
-
DefaultHeaders
public DefaultHeaders(HashingStrategy<K> nameHashingStrategy, ValueConverter<V> valueConverter, DefaultHeaders.NameValidator<K> nameValidator, int arraySizeHint, DefaultHeaders.ValueValidator<V> valueValidator) Create a new instance.- Parameters:
nameHashingStrategy- Used to hash and equality compare names.valueConverter- Used to convert values to/from native types.nameValidator- Used to validate name elements.arraySizeHint- A hint as to how large the hash data structure should be. The next positive power of two will be used. An upper bound may be enforced.valueValidator- The validation strategy for entry values.
-
-
Method Details
-
get
Description copied from interface:HeadersReturns 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. -
get
Description copied from interface:HeadersReturns 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. -
getAndRemove
Description copied from interface:HeadersReturns 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. -
getAndRemove
Description copied from interface:HeadersReturns 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. -
getAll
Description copied from interface:HeadersReturns all values for the header with the specified name. The returnedListcan't be modified. -
valueIterator
Equivalent togetAll(Object)but no intermediate list is generated.- Parameters:
name- the name of the header to retrieve- Returns:
- an
Iteratorof header values corresponding toname.
-
getAllAndRemove
Description copied from interface:HeadersReturns all values for the header with the specified name and removes them from this object. The returnedListcan't be modified. -
contains
Description copied from interface:HeadersReturnstrueif a header with thenameexists,falseotherwise. -
containsObject
Description copied from interface:HeadersReturnstrueif a header with the name and value exists. -
containsBoolean
Description copied from interface:HeadersReturnstrueif a header with the name and value exists. -
containsByte
Description copied from interface:HeadersReturnstrueif a header with the name and value exists. -
containsChar
Description copied from interface:HeadersReturnstrueif a header with the name and value exists. -
containsShort
Description copied from interface:HeadersReturnstrueif a header with the name and value exists. -
containsInt
Description copied from interface:HeadersReturnstrueif a header with the name and value exists. -
containsLong
Description copied from interface:HeadersReturnstrueif a header with the name and value exists. -
containsFloat
Description copied from interface:HeadersReturnstrueif a header with the name and value exists. -
containsDouble
Description copied from interface:HeadersReturnstrueif a header with the name and value exists. -
containsTimeMillis
Description copied from interface:HeadersReturnstrueif a header with the name and value exists. -
contains
Description copied from interface:HeadersReturnstrueif a header with thenameandvalueexists,falseotherwise.The
Object.equals(Object)method is used to test for equality ofvalue. -
contains
-
size
public int size()Description copied from interface:HeadersReturns the number of headers in this object. -
isEmpty
public boolean isEmpty()Description copied from interface:Headers -
names
Description copied from interface:Headers -
add
Description copied from interface:HeadersAdds a new header with the specifiednameandvalue. -
add
Description copied from interface:HeadersAdds new headers with the specifiednameandvalues. This method is semantically equivalent tofor (T value : values) { headers.add(name, value); } -
add
Description copied from interface:HeadersAdds new headers with the specifiednameandvalues. This method is semantically equivalent tofor (T value : values) { headers.add(name, value); } -
addObject
Description copied from interface:HeadersAdds a new header. Before thevalueis added, it's converted to typeT. -
addObject
Description copied from interface:HeadersAdds a new header with the specified name and values. This method is equivalent tofor (Object v : values) { headers.addObject(name, v); } -
addObject
Description copied from interface:HeadersAdds a new header with the specified name and values. This method is equivalent tofor (Object v : values) { headers.addObject(name, v); } -
addInt
Description copied from interface:HeadersAdds a new header. -
addLong
Description copied from interface:HeadersAdds a new header. -
addDouble
Description copied from interface:HeadersAdds a new header. -
addTimeMillis
Description copied from interface:HeadersAdds a new header. -
addChar
Description copied from interface:HeadersAdds a new header. -
addBoolean
Description copied from interface:HeadersAdds a new header. -
addFloat
Description copied from interface:HeadersAdds a new header. -
addByte
Description copied from interface:HeadersAdds a new header. -
addShort
Description copied from interface:HeadersAdds a new header. -
add
Description copied from interface:HeadersAdds all header names and values ofheadersto this object. -
addImpl
-
set
Description copied from interface:HeadersSets a header with the specified name and value. Any existing headers with the same name are overwritten. -
set
Description copied from interface:HeadersSets a new header with the specified name and values. This method is equivalent tofor (T v : values) { headers.addObject(name, v); } -
set
Description copied from interface:HeadersSets 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); } -
setObject
Description copied from interface:HeadersSets a new header. Any existing headers with this name are removed. Before thevalueis add, it's converted to typeT. -
setObject
Description copied from interface:HeadersSets 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); } -
setObject
Description copied from interface:HeadersSets 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); } -
setInt
Description copied from interface:HeadersSet thenametovalue. This will remove all previous values associated withname. -
setLong
Description copied from interface:HeadersSet thenametovalue. This will remove all previous values associated withname. -
setDouble
Description copied from interface:HeadersSet thenametovalue. This will remove all previous values associated withname. -
setTimeMillis
Description copied from interface:HeadersSet thenametovalue. This will remove all previous values associated withname. -
setFloat
Description copied from interface:HeadersSet thenametovalue. This will remove all previous values associated withname. -
setChar
Description copied from interface:HeadersSet thenametovalue. This will remove all previous values associated withname. -
setBoolean
Description copied from interface:HeadersSet thenametovalue. This will remove all previous values associated withname. -
setByte
Description copied from interface:HeadersSet thenametovalue. This will remove all previous values associated withname. -
setShort
Description copied from interface:HeadersSet thenametovalue. This will remove all previous values associated withname. -
set
Description copied from interface:HeadersClears the current header entries and copies all header entries of the specifiedheaders. -
setAll
Description copied from interface:HeadersRetains all current headers but callsHeaders.set(K, V)for each entry inheaders. -
remove
Description copied from interface:HeadersRemoves all headers with the specifiedname. -
clear
Description copied from interface:HeadersRemoves all headers. After a call to this methodHeaders.size()equals0. -
iterator
-
getBoolean
Description copied from interface:HeadersReturns 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. -
getBoolean
Description copied from interface:HeadersReturns 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.- Specified by:
getBooleanin interfaceHeaders<K,V, T extends Headers<K, V, T>> - 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
Description copied from interface:HeadersReturns 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. -
getByte
Description copied from interface:HeadersReturns 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. -
getChar
Description copied from interface:HeadersReturns 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. -
getChar
Description copied from interface:HeadersReturns 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. -
getShort
Description copied from interface:HeadersReturns 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. -
getShort
Description copied from interface:HeadersReturns 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.- Specified by:
getShortin interfaceHeaders<K,V, T extends Headers<K, V, T>> - 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
Description copied from interface:HeadersReturns 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. -
getInt
Description copied from interface:HeadersReturns 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. -
getLong
Description copied from interface:HeadersReturns 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. -
getLong
Description copied from interface:HeadersReturns 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. -
getFloat
Description copied from interface:HeadersReturns 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. -
getFloat
Description copied from interface:HeadersReturns 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.- Specified by:
getFloatin interfaceHeaders<K,V, T extends Headers<K, V, T>> - 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
Description copied from interface:HeadersReturns 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. -
getDouble
Description copied from interface:HeadersReturns 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.- Specified by:
getDoublein interfaceHeaders<K,V, T extends Headers<K, V, T>> - 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
Description copied from interface:HeadersReturns 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. -
getTimeMillis
Description copied from interface:HeadersReturns 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.- Specified by:
getTimeMillisin interfaceHeaders<K,V, T extends Headers<K, V, T>> - 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
Description copied from interface:HeadersReturns 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. -
getBooleanAndRemove
Description copied from interface:HeadersReturns 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.- Specified by:
getBooleanAndRemovein interfaceHeaders<K,V, T extends Headers<K, V, T>> - 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
Description copied from interface:HeadersReturns 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. -
getByteAndRemove
Description copied from interface:HeadersReturns 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.- Specified by:
getByteAndRemovein interfaceHeaders<K,V, T extends Headers<K, V, T>> - 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
Description copied from interface:HeadersReturns 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. -
getCharAndRemove
Description copied from interface:HeadersReturns 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.- Specified by:
getCharAndRemovein interfaceHeaders<K,V, T extends Headers<K, V, T>> - 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
Description copied from interface:HeadersReturns 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. -
getShortAndRemove
Description copied from interface:HeadersReturns 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.- Specified by:
getShortAndRemovein interfaceHeaders<K,V, T extends Headers<K, V, T>> - 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
Description copied from interface:HeadersReturns 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. -
getIntAndRemove
Description copied from interface:HeadersReturns 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.- Specified by:
getIntAndRemovein interfaceHeaders<K,V, T extends Headers<K, V, T>> - 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
Description copied from interface:HeadersReturns 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. -
getLongAndRemove
Description copied from interface:HeadersReturns 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.- Specified by:
getLongAndRemovein interfaceHeaders<K,V, T extends Headers<K, V, T>> - 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
Description copied from interface:HeadersReturns 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. -
getFloatAndRemove
Description copied from interface:HeadersReturns 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.- Specified by:
getFloatAndRemovein interfaceHeaders<K,V, T extends Headers<K, V, T>> - 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
Description copied from interface:HeadersReturns 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. -
getDoubleAndRemove
Description copied from interface:HeadersReturns 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.- Specified by:
getDoubleAndRemovein interfaceHeaders<K,V, T extends Headers<K, V, T>> - 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
Description copied from interface:HeadersReturns 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. -
getTimeMillisAndRemove
Description copied from interface:HeadersReturns 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.- Specified by:
getTimeMillisAndRemovein interfaceHeaders<K,V, T extends Headers<K, V, T>> - 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.
-
equals
-
hashCode
public int hashCode() -
equals
Test this object for equality againsth2.- Parameters:
h2- The object to check equality for.valueHashingStrategy- Defines how values will be compared for equality.- Returns:
trueif this object equalsh2givenvalueHashingStrategy.falseotherwise.
-
hashCode
Generate a hash code for this object given aHashingStrategyto generate hash codes for individual values.- Parameters:
valueHashingStrategy- Defines how values will be hashed.
-
toString
-
validateName
Call out to the givenDefaultHeaders.NameValidatorto validate the given name.- Parameters:
validator- the validator to useforAdd-trueif this validation is for adding to the headers, orfalseif this is for setting (overwriting) the given header.name- the name to validate.
-
validateValue
-
newHeaderEntry
protected DefaultHeaders.HeaderEntry<K,V> newHeaderEntry(int h, K name, V value, DefaultHeaders.HeaderEntry<K, V> next) -
valueConverter
-
nameValidator
-
valueValidator
-
index
private int index(int hash) -
add0
-
remove0
- Returns:
- the first value inserted whose hash code equals
hand whose name is equal toname.
-
remove0
DefaultHeaders.HeaderEntry<K,V> remove0(DefaultHeaders.HeaderEntry<K, V> entry, DefaultHeaders.HeaderEntry<K, V> previous) -
thisT
-
fromObject
-
fromBoolean
-
fromByte
-
fromChar
-
fromShort
-
fromInt
-
fromLong
-
fromFloat
-
fromDouble
-
fromTimeMillis
-
toBoolean
-
toByte
-
toChar
-
toShort
-
toInt
-
toLong
-
toFloat
-
toDouble
-
toTimeMillis
-
copy
Returns a deep copy of this instance.
-