public class EmptyHeaders<T> extends Object implements Headers<T>
Headers.EntryVisitor<T>, Headers.NameVisitor<T>, Headers.ValueConverter<T>| Constructor and Description |
|---|
EmptyHeaders() |
| Modifier and Type | Method and Description |
|---|---|
Headers<T> |
add(Headers<T> headers)
Adds all header entries of the specified
headers. |
Headers<T> |
add(T name,
Iterable<? extends T> values)
Adds a new header with the specified name and values.
|
Headers<T> |
add(T name,
T... values)
Adds a new header with the specified name and values.
|
Headers<T> |
add(T name,
T value)
Adds a new header with the specified name and value.
|
Headers<T> |
addBoolean(T name,
boolean value)
Add the
name to value. |
Headers<T> |
addByte(T name,
byte value)
Add the
name to value. |
Headers<T> |
addChar(T name,
char value)
Add the
name to value. |
Headers<T> |
addDouble(T name,
double value)
Add the
name to value. |
Headers<T> |
addFloat(T name,
float value)
Add the
name to value. |
Headers<T> |
addInt(T name,
int value)
Add the
name to value. |
Headers<T> |
addLong(T name,
long value)
Add the
name to value. |
Headers<T> |
addObject(T name,
Iterable<?> values)
Adds a new header with the specified name and values.
|
Headers<T> |
addObject(T name,
Object... values)
Adds a new header with the specified name and values.
|
Headers<T> |
addObject(T name,
Object value)
Adds a new header with the specified name and value.
|
Headers<T> |
addShort(T name,
short value)
Add the
name to value. |
Headers<T> |
addTimeMillis(T name,
long value)
Add the
name to value. |
Headers<T> |
clear()
Removes all headers.
|
boolean |
contains(T name)
Returns
true if and only if this collection contains the header with the specified name. |
boolean |
contains(T name,
T value)
Returns
true if a header with the name and value exists. |
boolean |
contains(T name,
T value,
Comparator<? super T> comparator)
Returns
true if a header with the name and value exists. |
boolean |
contains(T name,
T value,
Comparator<? super T> keyComparator,
Comparator<? super T> valueComparator)
Returns
true if a header with the name and value exists. |
boolean |
containsBoolean(T name,
boolean value)
Returns
true if a header with the name and value exists. |
boolean |
containsByte(T name,
byte value)
Returns
true if a header with the name and value exists. |
boolean |
containsChar(T name,
char value)
Returns
true if a header with the name and value exists. |
boolean |
containsDouble(T name,
double value)
Returns
true if a header with the name and value exists. |
boolean |
containsFloat(T name,
float value)
Returns
true if a header with the name and value exists. |
boolean |
containsInt(T name,
int value)
Returns
true if a header with the name and value exists. |
boolean |
containsLong(T name,
long value)
Returns
true if a header with the name and value exists. |
boolean |
containsObject(T name,
Object value)
Returns
true if a header with the name and value exists. |
boolean |
containsObject(T name,
Object value,
Comparator<? super T> comparator)
Returns
true if a header with the name and value exists. |
boolean |
containsObject(T name,
Object value,
Comparator<? super T> keyComparator,
Comparator<? super T> valueComparator)
Returns
true if a header with the name and value exists. |
boolean |
containsShort(T name,
short value)
Returns
true if a header with the name and value exists. |
boolean |
containsTimeMillis(T name,
long value)
Returns
true if a header with the name and value exists. |
List<Map.Entry<T,T>> |
entries()
Returns a new
List that contains all headers in this object. |
boolean |
equals(Object o) |
Map.Entry<T,T> |
forEachEntry(Headers.EntryVisitor<T> visitor)
Provide a means of iterating over elements in this map with low GC
|
T |
forEachName(Headers.NameVisitor<T> visitor)
Provide a means of iterating over elements in this map with low GC
|
T |
get(T name)
Returns the value of a header with the specified name.
|
T |
get(T name,
T defaultValue)
Returns the value of a header with the specified name.
|
List<T> |
getAll(T name)
Returns the values of headers with the specified name
|
List<T> |
getAllAndRemove(T name)
Returns and Removes the values of headers with the specified name
|
T |
getAndRemove(T name)
Returns and removes the value of a header with the specified name.
|
T |
getAndRemove(T name,
T defaultValue)
Returns and removes the value of a header with the specified name.
|
Boolean |
getBoolean(T name)
Returns the boolean value of a header with the specified name.
|
boolean |
getBoolean(T name,
boolean defaultValue)
Returns the boolean value of a header with the specified name.
|
Boolean |
getBooleanAndRemove(T name)
Returns and removes the boolean value of a header with the specified name.
|
boolean |
getBooleanAndRemove(T name,
boolean defaultValue)
Returns and removes the boolean value of a header with the specified name.
|
Byte |
getByte(T name)
Returns the byte value of a header with the specified name.
|
byte |
getByte(T name,
byte defaultValue)
Returns the byte value of a header with the specified name.
|
Byte |
getByteAndRemove(T name)
Returns and removes the byte value of a header with the specified name.
|
byte |
getByteAndRemove(T name,
byte defaultValue)
Returns and removes the byte value of a header with the specified name.
|
Character |
getChar(T name)
Returns the char value of a header with the specified name.
|
char |
getChar(T name,
char defaultValue)
Returns the char value of a header with the specified name.
|
Character |
getCharAndRemove(T name)
Returns and removes the char value of a header with the specified name.
|
char |
getCharAndRemove(T name,
char defaultValue)
Returns and removes the char value of a header with the specified name.
|
Double |
getDouble(T name)
Returns the double value of a header with the specified name.
|
double |
getDouble(T name,
double defaultValue)
Returns the double value of a header with the specified name.
|
Double |
getDoubleAndRemove(T name)
Returns and removes the double value of a header with the specified name.
|
double |
getDoubleAndRemove(T name,
double defaultValue)
Returns and removes the double value of a header with the specified name.
|
Float |
getFloat(T name)
Returns the float value of a header with the specified name.
|
float |
getFloat(T name,
float defaultValue)
Returns the float value of a header with the specified name.
|
Float |
getFloatAndRemove(T name)
Returns and removes the float value of a header with the specified name.
|
float |
getFloatAndRemove(T name,
float defaultValue)
Returns and removes the float value of a header with the specified name.
|
Integer |
getInt(T name)
Returns the integer value of a header with the specified name.
|
int |
getInt(T name,
int defaultValue)
Returns the integer value of a header with the specified name.
|
short |
getInt(T name,
short defaultValue)
Returns the short value of a header with the specified name.
|
Integer |
getIntAndRemove(T name)
Returns and removes the integer value of a header with the specified name.
|
int |
getIntAndRemove(T name,
int defaultValue)
Returns and removes the integer value of a header with the specified name.
|
Long |
getLong(T name)
Returns the long value of a header with the specified name.
|
long |
getLong(T name,
long defaultValue)
Returns the long value of a header with the specified name.
|
Long |
getLongAndRemove(T name)
Returns and removes the long value of a header with the specified name.
|
long |
getLongAndRemove(T name,
long defaultValue)
Returns and removes the long value of a header with the specified name.
|
Short |
getShort(T name)
Returns the short value of a header with the specified name.
|
Short |
getShortAndRemove(T name)
Returns and removes the short value of a header with the specified name.
|
short |
getShortAndRemove(T name,
short defaultValue)
Returns and removes the short value of a header with the specified name.
|
Long |
getTimeMillis(T name)
Returns the date value of a header with the specified name as milliseconds.
|
long |
getTimeMillis(T name,
long defaultValue)
Returns the date value of a header with the specified name as milliseconds.
|
Long |
getTimeMillisAndRemove(T name)
Returns and removes the date value of a header with the specified name as milliseconds.
|
long |
getTimeMillisAndRemove(T name,
long defaultValue)
Returns and removes the date value of a header with the specified name as milliseconds.
|
int |
hashCode() |
boolean |
isEmpty()
Returns
true if and only if this collection contains no header entries. |
Iterator<Map.Entry<T,T>> |
iterator() |
Set<T> |
names()
Returns a new
Set that contains the names of all headers in this object. |
List<T> |
namesList()
Returns a new
List that contains the names of all headers in this object. |
boolean |
remove(T name)
Removes the header with the specified name.
|
Headers<T> |
set(Headers<T> headers)
Cleans the current header entries and copies all header entries of the specified
headers. |
Headers<T> |
set(T name,
Iterable<? extends T> values)
Sets a header with the specified name and values.
|
Headers<T> |
set(T name,
T... values)
Sets a header with the specified name and values.
|
Headers<T> |
set(T name,
T value)
Sets a header with the specified name and value.
|
Headers<T> |
setAll(Headers<T> headers)
Retains all current headers but calls
Headers.set(Object, Object) for each entry in headers |
Headers<T> |
setBoolean(T name,
boolean value)
Set the
name to value. |
Headers<T> |
setByte(T name,
byte value)
Set the
name to value. |
Headers<T> |
setChar(T name,
char value)
Set the
name to value. |
Headers<T> |
setDouble(T name,
double value)
Set the
name to value. |
Headers<T> |
setFloat(T name,
float value)
Set the
name to value. |
Headers<T> |
setInt(T name,
int value)
Set the
name to value. |
Headers<T> |
setLong(T name,
long value)
Set the
name to value. |
Headers<T> |
setObject(T name,
Iterable<?> values)
Sets a header with the specified name and values.
|
Headers<T> |
setObject(T name,
Object... values)
Sets a header with the specified name and values.
|
Headers<T> |
setObject(T name,
Object value)
Sets a header with the specified name and value.
|
Headers<T> |
setShort(T name,
short value)
Set the
name to value. |
Headers<T> |
setTimeMillis(T name,
long value)
Set the
name to value. |
int |
size()
Returns the number of header entries in this collection.
|
String |
toString() |
public T get(T name)
Headerspublic T get(T name, T defaultValue)
Headerspublic T getAndRemove(T name)
HeadersgetAndRemove in interface Headers<T>name - the name of the header to searchnull if there is no such headerpublic T getAndRemove(T name, T defaultValue)
HeadersgetAndRemove in interface Headers<T>name - the name of the header to searchdefaultValue - the default valuedefaultValue if there is no such headerpublic List<T> getAll(T name)
Headerspublic List<T> getAllAndRemove(T name)
HeadersgetAllAndRemove in interface Headers<T>name - The name of the headers to searchList of header values which will be empty if no values are foundpublic Boolean getBoolean(T name)
HeadersgetBoolean in interface Headers<T>name - the name of the header to searchnull if there's no such
header or its value is not a boolean.public boolean getBoolean(T name, boolean defaultValue)
HeadersgetBoolean in interface Headers<T>name - the name of the header to searchdefaultValue - the default valuedefaultValue if there's
no such header or its value is not a boolean.public Byte getByte(T name)
Headerspublic byte getByte(T name, byte defaultValue)
Headerspublic Character getChar(T name)
Headerspublic char getChar(T name, char defaultValue)
Headerspublic Short getShort(T name)
Headerspublic short getInt(T name, short defaultValue)
Headerspublic Integer getInt(T name)
Headerspublic int getInt(T name, int defaultValue)
Headerspublic Long getLong(T name)
Headerspublic long getLong(T name, long defaultValue)
Headerspublic Float getFloat(T name)
Headerspublic float getFloat(T name, float defaultValue)
Headerspublic Double getDouble(T name)
Headerspublic double getDouble(T name, double defaultValue)
Headerspublic Long getTimeMillis(T name)
HeadersgetTimeMillis in interface Headers<T>name - The name of the header to searchnull if
there's no such header or its value is not a date.public long getTimeMillis(T name, long defaultValue)
HeadersgetTimeMillis in interface Headers<T>name - The name of the header to searchdefaultValue - default valuedefaultValue if there's no such header or its value is not a date.public Boolean getBooleanAndRemove(T name)
HeadersgetBooleanAndRemove in interface Headers<T>name - the name of the header to searchnull if there's no such
header or its value is not a boolean.public boolean getBooleanAndRemove(T name, boolean defaultValue)
HeadersgetBooleanAndRemove in interface Headers<T>name - the name of the header to searchdefaultValue - the default valuedefaultValue if there
is no such header or its value of header is not a boolean.public Byte getByteAndRemove(T name)
HeadersgetByteAndRemove in interface Headers<T>name - the name of the header to searchnull if there's no such
header or its value is not a byte.public byte getByteAndRemove(T name, byte defaultValue)
HeadersgetByteAndRemove in interface Headers<T>name - the name of the header to searchdefaultValue - the default valuedefaultValue if there is
no such header or its value of header is not a byte.public Character getCharAndRemove(T name)
HeadersgetCharAndRemove in interface Headers<T>name - the name of the header to searchnull if there's no such
header or its value is not a char.public char getCharAndRemove(T name, char defaultValue)
HeadersgetCharAndRemove in interface Headers<T>name - the name of the header to searchdefaultValue - the default valuedefaultValue if there is
no such header or its value of header is not a char.public Short getShortAndRemove(T name)
HeadersgetShortAndRemove in interface Headers<T>name - the name of the header to searchnull if there's no such
header or its value is not a short.public short getShortAndRemove(T name, short defaultValue)
HeadersgetShortAndRemove in interface Headers<T>name - the name of the header to searchdefaultValue - the default valuedefaultValue if there is
no such header or its value of header is not a short.public Integer getIntAndRemove(T name)
HeadersgetIntAndRemove in interface Headers<T>name - the name of the header to searchnull if there's no
such header or its value is not an integer.public int getIntAndRemove(T name, int defaultValue)
HeadersgetIntAndRemove in interface Headers<T>name - the name of the header to searchdefaultValue - the default valuedefaultValue if there
is no such header or its value of header is not an integer.public Long getLongAndRemove(T name)
HeadersgetLongAndRemove in interface Headers<T>name - the name of the header to searchnull if there's no such
header or its value is not a long.public long getLongAndRemove(T name, long defaultValue)
HeadersgetLongAndRemove in interface Headers<T>name - the name of the header to searchdefaultValue - the default valuedefaultValue if there's no
such header or its value is not a long.public Float getFloatAndRemove(T name)
HeadersgetFloatAndRemove in interface Headers<T>name - the name of the header to searchnull if there's no such
header or its value is not a float.public float getFloatAndRemove(T name, float defaultValue)
HeadersgetFloatAndRemove in interface Headers<T>name - the name of the header to searchdefaultValue - the default valuedefaultValue if there's
no such header or its value is not a float.public Double getDoubleAndRemove(T name)
HeadersgetDoubleAndRemove in interface Headers<T>name - the name of the header to searchnull if there's no such
header or its value is not a double.public double getDoubleAndRemove(T name, double defaultValue)
HeadersgetDoubleAndRemove in interface Headers<T>name - the name of the header to searchdefaultValue - the default valuedefaultValue if there's
no such header or its value is not a double.public Long getTimeMillisAndRemove(T name)
HeadersgetTimeMillisAndRemove in interface Headers<T>name - The name of the header to searchnull if
there's no such header or its value is not a date.public long getTimeMillisAndRemove(T name, long defaultValue)
HeadersgetTimeMillisAndRemove in interface Headers<T>name - The name of the header to searchdefaultValue - default valuedefaultValue if there's no such header or its value is not a date.public List<Map.Entry<T,T>> entries()
HeadersList that contains all headers in this object. Note that modifying the returned
List will not affect the state of this object. If you intend to enumerate over the header entries only,
use Headers.iterator() instead, which has much less overhead.public boolean contains(T name)
Headerstrue if and only if this collection contains the header with the specified name.public boolean contains(T name, T value)
Headerstrue if a header with the name and value exists.public boolean containsObject(T name, Object value)
Headerstrue if a header with the name and value exists.containsObject in interface Headers<T>name - the header namevalue - the header valuetrue if it contains it false otherwisepublic boolean containsBoolean(T name, boolean value)
Headerstrue if a header with the name and value exists.containsBoolean in interface Headers<T>name - the header namevalue - the header valuetrue if it contains it false otherwisepublic boolean containsByte(T name, byte value)
Headerstrue if a header with the name and value exists.containsByte in interface Headers<T>name - the header namevalue - the header valuetrue if it contains it false otherwisepublic boolean containsChar(T name, char value)
Headerstrue if a header with the name and value exists.containsChar in interface Headers<T>name - the header namevalue - the header valuetrue if it contains it false otherwisepublic boolean containsShort(T name, short value)
Headerstrue if a header with the name and value exists.containsShort in interface Headers<T>name - the header namevalue - the header valuetrue if it contains it false otherwisepublic boolean containsInt(T name, int value)
Headerstrue if a header with the name and value exists.containsInt in interface Headers<T>name - the header namevalue - the header valuetrue if it contains it false otherwisepublic boolean containsLong(T name, long value)
Headerstrue if a header with the name and value exists.containsLong in interface Headers<T>name - the header namevalue - the header valuetrue if it contains it false otherwisepublic boolean containsFloat(T name, float value)
Headerstrue if a header with the name and value exists.containsFloat in interface Headers<T>name - the header namevalue - the header valuetrue if it contains it false otherwisepublic boolean containsDouble(T name, double value)
Headerstrue if a header with the name and value exists.containsDouble in interface Headers<T>name - the header namevalue - the header valuetrue if it contains it false otherwisepublic boolean containsTimeMillis(T name, long value)
Headerstrue if a header with the name and value exists.containsTimeMillis in interface Headers<T>name - the header namevalue - the header valuetrue if it contains it false otherwisepublic boolean contains(T name, T value, Comparator<? super T> comparator)
Headerstrue if a header with the name and value exists.public boolean contains(T name, T value, Comparator<? super T> keyComparator, Comparator<? super T> valueComparator)
Headerstrue if a header with the name and value exists.contains in interface Headers<T>name - the header namevalue - the header valuekeyComparator - The comparator to use when comparing name to names in this mapvalueComparator - The comparator to use when comparing value to values in this maptrue if it contains it false otherwisepublic boolean containsObject(T name, Object value, Comparator<? super T> comparator)
Headerstrue if a header with the name and value exists.containsObject in interface Headers<T>name - the header namevalue - the header valuecomparator - The comparator to use when comparing name and value to entries in this maptrue if it contains it false otherwisepublic boolean containsObject(T name, Object value, Comparator<? super T> keyComparator, Comparator<? super T> valueComparator)
Headerstrue if a header with the name and value exists.containsObject in interface Headers<T>name - the header namevalue - the header valuekeyComparator - The comparator to use when comparing name to names in this mapvalueComparator - The comparator to use when comparing value to values in this maptrue if it contains it false otherwisepublic int size()
Headerspublic boolean isEmpty()
Headerstrue if and only if this collection contains no header entries.public Set<T> names()
HeadersSet that contains the names of all headers in this object. Note that modifying the returned
Set will not affect the state of this object. If you intend to enumerate over the header entries only,
use Headers.iterator() instead, which has much less overhead.public List<T> namesList()
HeadersList that contains the names of all headers in this object. Note that modifying the
returned List will not affect the state of this object. If you intend to enumerate over the header
entries only, use Headers.iterator() instead, which has much less overhead.public Headers<T> add(T name, Iterable<? extends T> values)
Headers
for (Object v : values) {
if (v == null) {
break;
}
headers.add(name, v);
}
public Headers<T> add(T name, T... values)
Headers
for (Object v : values) {
if (v == null) {
break;
}
headers.add(name, v);
}
public Headers<T> addObject(T name, Object value)
Headerspublic Headers<T> addObject(T name, Iterable<?> values)
Headers
for (Object v : values) {
if (v == null) {
break;
}
headers.add(name, v);
}
public Headers<T> addObject(T name, Object... values)
Headers
for (Object v : values) {
if (v == null) {
break;
}
headers.add(name, v);
}
public Headers<T> addBoolean(T name, boolean value)
Headersname to value.addBoolean in interface Headers<T>name - The name to modifyvalue - The valuethispublic Headers<T> addByte(T name, byte value)
Headersname to value.public Headers<T> addChar(T name, char value)
Headersname to value.public Headers<T> addShort(T name, short value)
Headersname to value.public Headers<T> addInt(T name, int value)
Headersname to value.public Headers<T> addLong(T name, long value)
Headersname to value.public Headers<T> addFloat(T name, float value)
Headersname to value.public Headers<T> addDouble(T name, double value)
Headersname to value.public Headers<T> addTimeMillis(T name, long value)
Headersname to value.addTimeMillis in interface Headers<T>name - The name to modifyvalue - The valuethispublic Headers<T> add(Headers<T> headers)
Headersheaders.public Headers<T> set(T name, Iterable<? extends T> values)
Headers
headers.remove(name);
for (Object v : values) {
if (v == null) {
break;
}
headers.add(name, v);
}
public Headers<T> set(T name, T... values)
Headers
headers.remove(name);
for (Object v : values) {
if (v == null) {
break;
}
headers.add(name, v);
}
public Headers<T> setObject(T name, Object value)
Headerspublic Headers<T> setObject(T name, Iterable<?> values)
Headers
headers.remove(name);
for (Object v : values) {
if (v == null) {
break;
}
headers.add(name, v);
}
public Headers<T> setObject(T name, Object... values)
Headers
headers.remove(name);
for (Object v : values) {
if (v == null) {
break;
}
headers.add(name, v);
}
public Headers<T> setBoolean(T name, boolean value)
Headersname to value. This will remove all previous values associated with name.setBoolean in interface Headers<T>name - The name to modifyvalue - The valuethispublic Headers<T> setByte(T name, byte value)
Headersname to value. This will remove all previous values associated with name.public Headers<T> setChar(T name, char value)
Headersname to value. This will remove all previous values associated with name.public Headers<T> setShort(T name, short value)
Headersname to value. This will remove all previous values associated with name.public Headers<T> setInt(T name, int value)
Headersname to value. This will remove all previous values associated with name.public Headers<T> setLong(T name, long value)
Headersname to value. This will remove all previous values associated with name.public Headers<T> setFloat(T name, float value)
Headersname to value. This will remove all previous values associated with name.public Headers<T> setDouble(T name, double value)
Headersname to value. This will remove all previous values associated with name.public Headers<T> setTimeMillis(T name, long value)
Headersname to value. This will remove all previous values associated with name.setTimeMillis in interface Headers<T>name - The name to modifyvalue - The valuethispublic Headers<T> set(Headers<T> headers)
Headersheaders.public Headers<T> setAll(Headers<T> headers)
HeadersHeaders.set(Object, Object) for each entry in headerssetAll in interface Headers<T>headers - The headers used to Headers.set(Object, Object) values in this instancethispublic boolean remove(T name)
Headerspublic Map.Entry<T,T> forEachEntry(Headers.EntryVisitor<T> visitor) throws Exception
HeadersforEachEntry in interface Headers<T>visitor - The visitor which will visit each element in this mapnull if iteration went past the endExceptionpublic T forEachName(Headers.NameVisitor<T> visitor) throws Exception
HeadersforEachName in interface Headers<T>visitor - The visitor which will visit each element in this mapnull if iteration went past the endExceptionCopyright © 2008–2015 The Netty Project. All rights reserved.