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 return this object.
All Superinterfaces:
Iterable<Map.Entry<K,V>>
All Known Subinterfaces:
Http2Headers, SpdyHeaders, StompHeaders
All Known Implementing Classes:
CharSequenceMap, CombinedHttpHeaders.CombinedHttpHeadersImpl, DefaultHeaders, DefaultHeadersImpl, DefaultHttp2Headers, DefaultSpdyHeaders, DefaultStompHeaders, EmptyHeaders, EmptyHttp2Headers, ReadOnlyHttp2Headers

public interface Headers<K,V,T extends Headers<K,V,T>> extends Iterable<Map.Entry<K,V>>
Common interface for Headers which represents a mapping of key to value. Duplicate keys may be allowed by implementations.
  • Method Summary

    Modifier and Type
    Method
    Description
    add(Headers<? extends K,? extends V,?> headers)
    Adds all header names and values of headers to this object.
    add(K name, Iterable<? extends V> values)
    Adds new headers with the specified name and values.
    add(K name, V value)
    Adds a new header with the specified name and value.
    add(K name, V... values)
    Adds new headers with the specified name and values.
    addBoolean(K name, boolean value)
    Adds a new header.
    addByte(K name, byte value)
    Adds a new header.
    addChar(K name, char value)
    Adds a new header.
    addDouble(K name, double value)
    Adds a new header.
    addFloat(K name, float value)
    Adds a new header.
    addInt(K name, int value)
    Adds a new header.
    addLong(K name, long value)
    Adds a new header.
    addObject(K name, Iterable<?> values)
    Adds a new header with the specified name and values.
    addObject(K name, Object value)
    Adds a new header.
    addObject(K name, Object... values)
    Adds a new header with the specified name and values.
    addShort(K name, short value)
    Adds a new header.
    addTimeMillis(K name, long value)
    Adds a new header.
    Removes all headers.
    boolean
    contains(K name)
    Returns true if a header with the name exists, false otherwise.
    boolean
    contains(K name, V value)
    Returns true if a header with the name and value exists, false otherwise.
    boolean
    containsBoolean(K name, boolean value)
    Returns true if a header with the name and value exists.
    boolean
    containsByte(K name, byte value)
    Returns true if a header with the name and value exists.
    boolean
    containsChar(K name, char value)
    Returns true if a header with the name and value exists.
    boolean
    containsDouble(K name, double value)
    Returns true if a header with the name and value exists.
    boolean
    containsFloat(K name, float value)
    Returns true if a header with the name and value exists.
    boolean
    containsInt(K name, int value)
    Returns true if a header with the name and value exists.
    boolean
    containsLong(K name, long value)
    Returns true if a header with the name and value exists.
    boolean
    containsObject(K name, Object value)
    Returns true if a header with the name and value exists.
    boolean
    containsShort(K name, short value)
    Returns true if a header with the name and value exists.
    boolean
    containsTimeMillis(K name, long value)
    Returns true if a header with the name and value exists.
    get(K name)
    Returns the value of a header with the specified name.
    get(K name, V defaultValue)
    Returns the value of a header with the specified name.
    getAll(K name)
    Returns all values for the header with the specified name.
    Returns all values for the header with the specified name and removes them from this object.
    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 the boolean value of a header with the specified name.
    boolean
    getBoolean(K name, boolean defaultValue)
    Returns the boolean value of a header with the specified name.
    Returns the boolean value of a header with the specified name and removes the header from this object.
    boolean
    getBooleanAndRemove(K name, boolean defaultValue)
    Returns the boolean value of a header with the specified name and removes the header from this object.
    getByte(K name)
    Returns the byte value of a header with the specified name.
    byte
    getByte(K name, byte defaultValue)
    Returns the byte value of a header with the specified name.
    Returns the byte value of a header with the specified name and removes the header from this object.
    byte
    getByteAndRemove(K name, byte defaultValue)
    Returns the byte value of a header with the specified name and removes the header from this object.
    getChar(K name)
    Returns the char value of a header with the specified name.
    char
    getChar(K name, char defaultValue)
    Returns the char value of a header with the specified name.
    Returns the char value of a header with the specified name and removes the header from this object.
    char
    getCharAndRemove(K name, char defaultValue)
    Returns the char value of a header with the specified name and removes the header from this object.
    getDouble(K name)
    Returns the double value of a header with the specified name.
    double
    getDouble(K name, double defaultValue)
    Returns the double value of a header with the specified name.
    Returns the double value of a header with the specified name and removes the header from this object.
    double
    getDoubleAndRemove(K name, double defaultValue)
    Returns the double value of a header with the specified name and removes the header from this object.
    getFloat(K name)
    Returns the float value of a header with the specified name.
    float
    getFloat(K name, float defaultValue)
    Returns the float value of a header with the specified name.
    Returns the float value of a header with the specified name and removes the header from this object.
    float
    getFloatAndRemove(K name, float defaultValue)
    Returns the float value of a header with the specified name and removes the header from this object.
    getInt(K name)
    Returns the int value of a header with the specified name.
    int
    getInt(K name, int defaultValue)
    Returns the int value of a header with the specified name.
    Returns the int value of a header with the specified name and removes the header from this object.
    int
    getIntAndRemove(K name, int defaultValue)
    Returns the int value of a header with the specified name and removes the header from this object.
    getLong(K name)
    Returns the long value of a header with the specified name.
    long
    getLong(K name, long defaultValue)
    Returns the long value of a header with the specified name.
    Returns the long value of a header with the specified name and removes the header from this object.
    long
    getLongAndRemove(K name, long defaultValue)
    Returns the long value of a header with the specified name and removes the header from this object.
    getShort(K name)
    Returns the short value of a header with the specified name.
    short
    getShort(K name, short defaultValue)
    Returns the short value of a header with the specified name.
    Returns the short value of a header with the specified name and removes the header from this object.
    short
    getShortAndRemove(K name, short defaultValue)
    Returns the short value of a header with the specified name and removes the header from this object.
    Returns the value of a header with the specified name in milliseconds.
    long
    getTimeMillis(K name, long defaultValue)
    Returns the value of a header with the specified name in milliseconds.
    Returns the value of a header with the specified name in milliseconds and removes the header from this object.
    long
    getTimeMillisAndRemove(K name, long defaultValue)
    Returns the value of a header with the specified name in milliseconds and removes the header from this object.
    boolean
    Returns true if size() equals 0.
     
    Returns a Set of all header names in this object.
    boolean
    remove(K name)
    Removes all headers with the specified name.
    set(Headers<? extends K,? extends V,?> headers)
    Clears the current header entries and copies all header entries of the specified headers.
    set(K name, Iterable<? extends V> values)
    Sets a new header with the specified name and values.
    set(K name, V value)
    Sets a header with the specified name and value.
    set(K name, V... values)
    Sets a header with the specified name and values.
    setAll(Headers<? extends K,? extends V,?> headers)
    Retains all current headers but calls set(K, V) for each entry in headers.
    setBoolean(K name, boolean value)
    Set the name to value.
    setByte(K name, byte value)
    Set the name to value.
    setChar(K name, char value)
    Set the name to value.
    setDouble(K name, double value)
    Set the name to value.
    setFloat(K name, float value)
    Set the name to value.
    setInt(K name, int value)
    Set the name to value.
    setLong(K name, long value)
    Set the name to value.
    setObject(K name, Iterable<?> values)
    Sets a header with the specified name and values.
    setObject(K name, Object value)
    Sets a new header.
    setObject(K name, Object... values)
    Sets a header with the specified name and values.
    setShort(K name, short value)
    Set the name to value.
    setTimeMillis(K name, long value)
    Set the name to value.
    int
    Returns the number of headers in this object.

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Method Details

    • get

      V get(K name)
      Returns the value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the first header value if the header is found. null if there's no such header
    • get

      V get(K name, V defaultValue)
      Returns the value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the first header value or defaultValue if there is no such header
    • getAndRemove

      V getAndRemove(K name)
      Returns the value of a header with the specified name and removes it from this object. If there is more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the first header value or null if there is no such header
    • getAndRemove

      V getAndRemove(K name, V defaultValue)
      Returns the value of a header with the specified name and removes it from this object. If there is more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the first header value or defaultValue if there is no such header
    • getAll

      List<V> getAll(K name)
      Returns all values for the header with the specified name. The returned List can't be modified.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      a List of header values or an empty List if no values are found.
    • getAllAndRemove

      List<V> getAllAndRemove(K name)
      Returns all values for the header with the specified name and removes them from this object. The returned List can't be modified.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      a List of header values or an empty List if no values are found.
    • getBoolean

      Boolean getBoolean(K name)
      Returns the boolean value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the boolean value of the first value in insertion order or null if there is no such value or it can't be converted to boolean.
    • getBoolean

      boolean getBoolean(K name, boolean defaultValue)
      Returns the boolean value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the boolean value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to boolean.
    • getByte

      Byte getByte(K name)
      Returns the byte value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the byte value of the first value in insertion order or null if there is no such value or it can't be converted to byte.
    • getByte

      byte getByte(K name, byte defaultValue)
      Returns the byte value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the byte value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to byte.
    • getChar

      Character getChar(K name)
      Returns the char value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the char value of the first value in insertion order or null if there is no such value or it can't be converted to char.
    • getChar

      char getChar(K name, char defaultValue)
      Returns the char value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the char value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to char.
    • getShort

      Short getShort(K name)
      Returns the short value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the short value of the first value in insertion order or null if there is no such value or it can't be converted to short.
    • getShort

      short getShort(K name, short defaultValue)
      Returns the short value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the short value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to short.
    • getInt

      Integer getInt(K name)
      Returns the int value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the int value of the first value in insertion order or null if there is no such value or it can't be converted to int.
    • getInt

      int getInt(K name, int defaultValue)
      Returns the int value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the int value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to int.
    • getLong

      Long getLong(K name)
      Returns the long value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the long value of the first value in insertion order or null if there is no such value or it can't be converted to long.
    • getLong

      long getLong(K name, long defaultValue)
      Returns the long value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the long value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to long.
    • getFloat

      Float getFloat(K name)
      Returns the float value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the float value of the first value in insertion order or null if there is no such value or it can't be converted to float.
    • getFloat

      float getFloat(K name, float defaultValue)
      Returns the float value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the float value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to float.
    • getDouble

      Double getDouble(K name)
      Returns the double value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the double value of the first value in insertion order or null if there is no such value or it can't be converted to double.
    • getDouble

      double getDouble(K name, double defaultValue)
      Returns the double value of a header with the specified name. If there is more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the double value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to double.
    • getTimeMillis

      Long getTimeMillis(K name)
      Returns the value of a header with the specified name in milliseconds. If there is more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      Returns:
      the milliseconds value of the first value in insertion order or null if there is no such value or it can't be converted to milliseconds.
    • getTimeMillis

      long getTimeMillis(K name, long defaultValue)
      Returns the value of a header with the specified name in milliseconds. If there is more than one value for the specified name, the first value in insertion order is returned.
      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the milliseconds value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to milliseconds.
    • getBooleanAndRemove

      Boolean getBooleanAndRemove(K name)
      Returns the boolean value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Parameters:
      name - the name of the header to retrieve
      Returns:
      the boolean value of the first value in insertion order or null if there is no such value or it can't be converted to boolean.
    • getBooleanAndRemove

      boolean getBooleanAndRemove(K name, boolean defaultValue)
      Returns the boolean value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Parameters:
      name - the name of the header to search
      defaultValue - the default value
      Returns:
      the boolean value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to boolean.
    • getByteAndRemove

      Byte getByteAndRemove(K name)
      Returns the byte value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Parameters:
      name - the name of the header to search
      Returns:
      the byte value of the first value in insertion order or null if there is no such value or it can't be converted to byte.
    • getByteAndRemove

      byte getByteAndRemove(K name, byte defaultValue)
      Returns the byte value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Parameters:
      name - the name of the header to search
      defaultValue - the default value
      Returns:
      the byte value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to byte.
    • getCharAndRemove

      Character getCharAndRemove(K name)
      Returns the char value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Parameters:
      name - the name of the header to search
      Returns:
      the char value of the first value in insertion order or null if there is no such value or it can't be converted to char.
    • getCharAndRemove

      char getCharAndRemove(K name, char defaultValue)
      Returns the char value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Parameters:
      name - the name of the header to search
      defaultValue - the default value
      Returns:
      the char value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to char.
    • getShortAndRemove

      Short getShortAndRemove(K name)
      Returns the short value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Parameters:
      name - the name of the header to search
      Returns:
      the short value of the first value in insertion order or null if there is no such value or it can't be converted to short.
    • getShortAndRemove

      short getShortAndRemove(K name, short defaultValue)
      Returns the short value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Parameters:
      name - the name of the header to search
      defaultValue - the default value
      Returns:
      the short value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to short.
    • getIntAndRemove

      Integer getIntAndRemove(K name)
      Returns the int value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Parameters:
      name - the name of the header to search
      Returns:
      the int value of the first value in insertion order or null if there is no such value or it can't be converted to int.
    • getIntAndRemove

      int getIntAndRemove(K name, int defaultValue)
      Returns the int value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Parameters:
      name - the name of the header to search
      defaultValue - the default value
      Returns:
      the int value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to int.
    • getLongAndRemove

      Long getLongAndRemove(K name)
      Returns the long value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Parameters:
      name - the name of the header to search
      Returns:
      the long value of the first value in insertion order or null if there is no such value or it can't be converted to long.
    • getLongAndRemove

      long getLongAndRemove(K name, long defaultValue)
      Returns the long value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Parameters:
      name - the name of the header to search
      defaultValue - the default value
      Returns:
      the long value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to long.
    • getFloatAndRemove

      Float getFloatAndRemove(K name)
      Returns the float value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Parameters:
      name - the name of the header to search
      Returns:
      the float value of the first value in insertion order or null if there is no such value or it can't be converted to float.
    • getFloatAndRemove

      float getFloatAndRemove(K name, float defaultValue)
      Returns the float value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Parameters:
      name - the name of the header to search
      defaultValue - the default value
      Returns:
      the float value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to float.
    • getDoubleAndRemove

      Double getDoubleAndRemove(K name)
      Returns the double value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Parameters:
      name - the name of the header to search
      Returns:
      the double value of the first value in insertion order or null if there is no such value or it can't be converted to double.
    • getDoubleAndRemove

      double getDoubleAndRemove(K name, double defaultValue)
      Returns the double value of a header with the specified name and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Parameters:
      name - the name of the header to search
      defaultValue - the default value
      Returns:
      the double value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to double.
    • getTimeMillisAndRemove

      Long getTimeMillisAndRemove(K name)
      Returns the value of a header with the specified name in milliseconds and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Parameters:
      name - the name of the header to retrieve
      Returns:
      the milliseconds value of the first value in insertion order or null if there is no such value or it can't be converted to milliseconds.
    • getTimeMillisAndRemove

      long getTimeMillisAndRemove(K name, long defaultValue)
      Returns the value of a header with the specified name in milliseconds and removes the header from this object. If there is more than one value for the specified name, the first value in insertion order is returned. In any case all values for name are removed.

      If an exception occurs during the translation from type T all entries with name may still be removed.

      Parameters:
      name - the name of the header to retrieve
      defaultValue - the default value
      Returns:
      the milliseconds value of the first value in insertion order or defaultValue if there is no such value or it can't be converted to milliseconds.
    • contains

      boolean contains(K name)
      Returns true if a header with the name exists, false otherwise.
      Parameters:
      name - the header name
    • contains

      boolean contains(K name, V value)
      Returns true if a header with the name and value exists, false otherwise.

      The Object.equals(Object) method is used to test for equality of value.

      Parameters:
      name - the header name
      value - the header value of the header to find
    • containsObject

      boolean containsObject(K name, Object value)
      Returns true if a header with the name and value exists.
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if it contains it false otherwise
    • containsBoolean

      boolean containsBoolean(K name, boolean value)
      Returns true if a header with the name and value exists.
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if it contains it false otherwise
    • containsByte

      boolean containsByte(K name, byte value)
      Returns true if a header with the name and value exists.
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if it contains it false otherwise
    • containsChar

      boolean containsChar(K name, char value)
      Returns true if a header with the name and value exists.
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if it contains it false otherwise
    • containsShort

      boolean containsShort(K name, short value)
      Returns true if a header with the name and value exists.
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if it contains it false otherwise
    • containsInt

      boolean containsInt(K name, int value)
      Returns true if a header with the name and value exists.
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if it contains it false otherwise
    • containsLong

      boolean containsLong(K name, long value)
      Returns true if a header with the name and value exists.
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if it contains it false otherwise
    • containsFloat

      boolean containsFloat(K name, float value)
      Returns true if a header with the name and value exists.
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if it contains it false otherwise
    • containsDouble

      boolean containsDouble(K name, double value)
      Returns true if a header with the name and value exists.
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if it contains it false otherwise
    • containsTimeMillis

      boolean containsTimeMillis(K name, long value)
      Returns true if a header with the name and value exists.
      Parameters:
      name - the header name
      value - the header value
      Returns:
      true if it contains it false otherwise
    • size

      int size()
      Returns the number of headers in this object.
    • isEmpty

      boolean isEmpty()
      Returns true if size() equals 0.
    • names

      Set<K> names()
      Returns a Set of all header names in this object. The returned Set cannot be modified.
    • add

      T add(K name, V value)
      Adds a new header with the specified name and value.
      Parameters:
      name - the name of the header
      value - the value of the header
      Returns:
      this
    • add

      T add(K name, Iterable<? extends V> values)
      Adds new headers with the specified name and values. This method is semantically equivalent to
       for (T value : values) {
           headers.add(name, value);
       }
       
      Parameters:
      name - the header name
      values - the values of the header
      Returns:
      this
    • add

      T add(K name, V... values)
      Adds new headers with the specified name and values. This method is semantically equivalent to
       for (T value : values) {
           headers.add(name, value);
       }
       
      Parameters:
      name - the header name
      values - the values of the header
      Returns:
      this
    • addObject

      T addObject(K name, Object value)
      Adds a new header. Before the value is added, it's converted to type T.
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • addObject

      T addObject(K name, Iterable<?> values)
      Adds a new header with the specified name and values. This method is equivalent to
       for (Object v : values) {
           headers.addObject(name, v);
       }
       
      Parameters:
      name - the header name
      values - the value of the header
      Returns:
      this
    • addObject

      T addObject(K name, Object... values)
      Adds a new header with the specified name and values. This method is equivalent to
       for (Object v : values) {
           headers.addObject(name, v);
       }
       
      Parameters:
      name - the header name
      values - the value of the header
      Returns:
      this
    • addBoolean

      T addBoolean(K name, boolean value)
      Adds a new header.
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • addByte

      T addByte(K name, byte value)
      Adds a new header.
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • addChar

      T addChar(K name, char value)
      Adds a new header.
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • addShort

      T addShort(K name, short value)
      Adds a new header.
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • addInt

      T addInt(K name, int value)
      Adds a new header.
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • addLong

      T addLong(K name, long value)
      Adds a new header.
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • addFloat

      T addFloat(K name, float value)
      Adds a new header.
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • addDouble

      T addDouble(K name, double value)
      Adds a new header.
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • addTimeMillis

      T addTimeMillis(K name, long value)
      Adds a new header.
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
    • add

      T add(Headers<? extends K,? extends V,?> headers)
      Adds all header names and values of headers to this object.
      Returns:
      this
      Throws:
      IllegalArgumentException - if headers == 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 name
      value - the value of the header
      Returns:
      this
    • set

      T set(K name, Iterable<? extends V> values)
      Sets a new header with the specified name and values. This method is equivalent to
       for (T v : values) {
           headers.addObject(name, v);
       }
       
      Parameters:
      name - the header name
      values - 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 name
      values - the value of the header
      Returns:
      this
    • setObject

      T setObject(K name, Object value)
      Sets a new header. Any existing headers with this name are removed. Before the value is add, it's converted to type T.
      Parameters:
      name - the header name
      value - the value of the header
      Returns:
      this
      Throws:
      NullPointerException - if either name or value before or after its conversion is null.
    • setObject

      T setObject(K name, Iterable<?> values)
      Sets a header with the specified name and values. Any existing headers with this name are removed. This method is equivalent to:
       headers.remove(name);
       for (Object v : values) {
           headers.addObject(name, v);
       }
       
      Parameters:
      name - the header name
      values - the values of the header
      Returns:
      this
    • setObject

      T setObject(K name, Object... values)
      Sets a header with the specified name and values. Any existing headers with this name are removed. This method is equivalent to:
       headers.remove(name);
       for (Object v : values) {
           headers.addObject(name, v);
       }
       
      Parameters:
      name - the header name
      values - the values of the header
      Returns:
      this
    • setBoolean

      T setBoolean(K name, boolean value)
      Set the name to value. This will remove all previous values associated with name.
      Parameters:
      name - The name to modify
      value - The value
      Returns:
      this
    • setByte

      T setByte(K name, byte value)
      Set the name to value. This will remove all previous values associated with name.
      Parameters:
      name - The name to modify
      value - The value
      Returns:
      this
    • setChar

      T setChar(K name, char value)
      Set the name to value. This will remove all previous values associated with name.
      Parameters:
      name - The name to modify
      value - The value
      Returns:
      this
    • setShort

      T setShort(K name, short value)
      Set the name to value. This will remove all previous values associated with name.
      Parameters:
      name - The name to modify
      value - The value
      Returns:
      this
    • setInt

      T setInt(K name, int value)
      Set the name to value. This will remove all previous values associated with name.
      Parameters:
      name - The name to modify
      value - The value
      Returns:
      this
    • setLong

      T setLong(K name, long value)
      Set the name to value. This will remove all previous values associated with name.
      Parameters:
      name - The name to modify
      value - The value
      Returns:
      this
    • setFloat

      T setFloat(K name, float value)
      Set the name to value. This will remove all previous values associated with name.
      Parameters:
      name - The name to modify
      value - The value
      Returns:
      this
    • setDouble

      T setDouble(K name, double value)
      Set the name to value. This will remove all previous values associated with name.
      Parameters:
      name - The name to modify
      value - The value
      Returns:
      this
    • setTimeMillis

      T setTimeMillis(K name, long value)
      Set the name to value. This will remove all previous values associated with name.
      Parameters:
      name - The name to modify
      value - 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 specified headers.
      Returns:
      this
    • setAll

      T setAll(Headers<? extends K,? extends V,?> headers)
      Retains all current headers but calls set(K, V) for each entry in headers.
      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 specified name.
      Parameters:
      name - the header name
      Returns:
      true if at least one entry has been removed.
    • clear

      T clear()
      Removes all headers. After a call to this method size() equals 0.
      Returns:
      this
    • iterator

      Iterator<Map.Entry<K,V>> iterator()
      Specified by:
      iterator in interface Iterable<K>