Class DefaultHeaders<K,​V,​T extends Headers<K,​V,​T>>

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T add​(Headers<? extends K,​? extends V,​?> headers)
      Adds all header names and values of headers to this object.
      T add​(K name, Iterable<? extends V> values)
      Adds new headers with the specified name and values.
      T add​(K name, V value)
      Adds a new header with the specified name and value.
      T add​(K name, V... values)
      Adds new headers with the specified name and values.
      T addBoolean​(K name, boolean value)
      Adds a new header.
      T addByte​(K name, byte value)
      Adds a new header.
      T addChar​(K name, char value)
      Adds a new header.
      T addDouble​(K name, double value)
      Adds a new header.
      T addFloat​(K name, float value)
      Adds a new header.
      protected void addImpl​(Headers<? extends K,​? extends V,​?> headers)  
      T addInt​(K name, int value)
      Adds a new header.
      T addLong​(K name, long value)
      Adds a new header.
      T addObject​(K name, Iterable<?> values)
      Adds a new header with the specified name and values.
      T addObject​(K name, Object value)
      Adds a new header.
      T addObject​(K name, Object... values)
      Adds a new header with the specified name and values.
      T addShort​(K name, short value)
      Adds a new header.
      T addTimeMillis​(K name, long value)
      Adds a new header.
      T clear()
      Removes all headers.
      boolean contains​(K name)
      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 contains​(K name, V value, HashingStrategy<? super V> valueHashingStrategy)  
      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.
      DefaultHeaders<K,​V,​T> copy()
      Returns a deep copy of this instance.
      boolean equals​(Headers<K,​V,​?> h2, HashingStrategy<V> valueHashingStrategy)
      Test this object for equality against h2.
      boolean equals​(Object o)  
      V get​(K name)
      Returns the value of a header with the specified name.
      V get​(K name, V defaultValue)
      Returns the value of a header with the specified name.
      List<V> getAll​(K name)
      Returns all values for the header with the specified name.
      List<V> getAllAndRemove​(K name)
      Returns all values for the header with the specified name and removes them from this object.
      V getAndRemove​(K name)
      Returns the value of a header with the specified name and removes it from this object.
      V getAndRemove​(K name, V defaultValue)
      Returns the value of a header with the specified name and removes it from this object.
      Boolean getBoolean​(K name)
      Returns 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.
      Boolean getBooleanAndRemove​(K 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.
      Byte 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.
      Byte getByteAndRemove​(K 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.
      Character 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.
      Character getCharAndRemove​(K 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.
      Double 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.
      Double getDoubleAndRemove​(K 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.
      Float 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.
      Float getFloatAndRemove​(K 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.
      Integer 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.
      Integer getIntAndRemove​(K 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.
      Long 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.
      Long getLongAndRemove​(K 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.
      Short 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.
      Short getShortAndRemove​(K 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.
      Long getTimeMillis​(K name)
      Returns the value of a header with the specified name in milliseconds.
      long getTimeMillis​(K name, long defaultValue)
      Returns the value of a header with the specified name in milliseconds.
      Long getTimeMillisAndRemove​(K name)
      Returns the value of a header with the 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.
      int hashCode()  
      int hashCode​(HashingStrategy<V> valueHashingStrategy)
      Generate a hash code for this object given a HashingStrategy to generate hash codes for individual values.
      boolean isEmpty()
      Returns true if Headers.size() equals 0.
      Iterator<Map.Entry<K,​V>> iterator()  
      Set<K> names()
      Returns a Set of all header names in this object.
      protected DefaultHeaders.HeaderEntry<K,​V> newHeaderEntry​(int h, K name, V value, DefaultHeaders.HeaderEntry<K,​V> next)  
      boolean remove​(K name)
      Removes all headers with the specified name.
      T set​(Headers<? extends K,​? extends V,​?> headers)
      Clears the current header entries and copies all header entries of the specified headers.
      T set​(K name, Iterable<? extends V> values)
      Sets a new header with the specified name and values.
      T set​(K name, V value)
      Sets a header with the specified name and value.
      T set​(K name, V... values)
      Sets a header with the specified name and values.
      T setAll​(Headers<? extends K,​? extends V,​?> headers)
      Retains all current headers but calls #set(K, V) for each entry in headers.
      T setBoolean​(K name, boolean value)
      Set the name to value.
      T setByte​(K name, byte value)
      Set the name to value.
      T setChar​(K name, char value)
      Set the name to value.
      T setDouble​(K name, double value)
      Set the name to value.
      T setFloat​(K name, float value)
      Set the name to value.
      T setInt​(K name, int value)
      Set the name to value.
      T setLong​(K name, long value)
      Set the name to value.
      T setObject​(K name, Iterable<?> values)
      Sets a header with the specified name and values.
      T setObject​(K name, Object value)
      Sets a new header.
      T setObject​(K name, Object... values)
      Sets a header with the specified name and values.
      T setShort​(K name, short value)
      Set the name to value.
      T setTimeMillis​(K name, long value)
      Set the name to value.
      int size()
      Returns the number of headers in this object.
      String toString()  
      protected ValueConverter<V> valueConverter()  
      Iterator<V> valueIterator​(K name)
      Equivalent to getAll(Object) but no intermediate list is generated.
    • Method Detail

      • get

        public V get​(K name)
        Description copied from interface: Headers
        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.
        Specified by:
        get in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public V get​(K name,
                     V defaultValue)
        Description copied from interface: Headers
        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.
        Specified by:
        get in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public V getAndRemove​(K name)
        Description copied from interface: Headers
        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.
        Specified by:
        getAndRemove in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the name of the header to retrieve
        Returns:
        the first header value or null if there is no such header
      • getAndRemove

        public V getAndRemove​(K name,
                              V defaultValue)
        Description copied from interface: Headers
        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.
        Specified by:
        getAndRemove in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public List<V> getAll​(K name)
        Description copied from interface: Headers
        Returns all values for the header with the specified name. The returned List can't be modified.
        Specified by:
        getAll in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the name of the header to retrieve
        Returns:
        a List of header values or an empty List if no values are found.
      • valueIterator

        public Iterator<V> valueIterator​(K name)
        Equivalent to getAll(Object) but no intermediate list is generated.
        Parameters:
        name - the name of the header to retrieve
        Returns:
        an Iterator of header values corresponding to name.
      • getAllAndRemove

        public List<V> getAllAndRemove​(K name)
        Description copied from interface: Headers
        Returns all values for the header with the specified name and removes them from this object. The returned List can't be modified.
        Specified by:
        getAllAndRemove in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the name of the header to retrieve
        Returns:
        a List of header values or an empty List if no values are found.
      • contains

        public boolean contains​(K name)
        Description copied from interface: Headers
        Returns true if a header with the name exists, false otherwise.
        Specified by:
        contains in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
      • containsObject

        public boolean containsObject​(K name,
                                      Object value)
        Description copied from interface: Headers
        Returns true if a header with the name and value exists.
        Specified by:
        containsObject in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the header value
        Returns:
        true if it contains it false otherwise
      • containsBoolean

        public boolean containsBoolean​(K name,
                                       boolean value)
        Description copied from interface: Headers
        Returns true if a header with the name and value exists.
        Specified by:
        containsBoolean in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the header value
        Returns:
        true if it contains it false otherwise
      • containsByte

        public boolean containsByte​(K name,
                                    byte value)
        Description copied from interface: Headers
        Returns true if a header with the name and value exists.
        Specified by:
        containsByte in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the header value
        Returns:
        true if it contains it false otherwise
      • containsChar

        public boolean containsChar​(K name,
                                    char value)
        Description copied from interface: Headers
        Returns true if a header with the name and value exists.
        Specified by:
        containsChar in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the header value
        Returns:
        true if it contains it false otherwise
      • containsShort

        public boolean containsShort​(K name,
                                     short value)
        Description copied from interface: Headers
        Returns true if a header with the name and value exists.
        Specified by:
        containsShort in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the header value
        Returns:
        true if it contains it false otherwise
      • containsInt

        public boolean containsInt​(K name,
                                   int value)
        Description copied from interface: Headers
        Returns true if a header with the name and value exists.
        Specified by:
        containsInt in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the header value
        Returns:
        true if it contains it false otherwise
      • containsLong

        public boolean containsLong​(K name,
                                    long value)
        Description copied from interface: Headers
        Returns true if a header with the name and value exists.
        Specified by:
        containsLong in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the header value
        Returns:
        true if it contains it false otherwise
      • containsFloat

        public boolean containsFloat​(K name,
                                     float value)
        Description copied from interface: Headers
        Returns true if a header with the name and value exists.
        Specified by:
        containsFloat in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the header value
        Returns:
        true if it contains it false otherwise
      • containsDouble

        public boolean containsDouble​(K name,
                                      double value)
        Description copied from interface: Headers
        Returns true if a header with the name and value exists.
        Specified by:
        containsDouble in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the header value
        Returns:
        true if it contains it false otherwise
      • containsTimeMillis

        public boolean containsTimeMillis​(K name,
                                          long value)
        Description copied from interface: Headers
        Returns true if a header with the name and value exists.
        Specified by:
        containsTimeMillis in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the header value
        Returns:
        true if it contains it false otherwise
      • contains

        public boolean contains​(K name,
                                V value)
        Description copied from interface: Headers
        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.

        Specified by:
        contains in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the header value of the header to find
      • contains

        public final boolean contains​(K name,
                                      V value,
                                      HashingStrategy<? super V> valueHashingStrategy)
      • size

        public int size()
        Description copied from interface: Headers
        Returns the number of headers in this object.
        Specified by:
        size in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
      • names

        public Set<K> names()
        Description copied from interface: Headers
        Returns a Set of all header names in this object. The returned Set cannot be modified.
        Specified by:
        names in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
      • add

        public T add​(K name,
                     V value)
        Description copied from interface: Headers
        Adds a new header with the specified name and value.
        Specified by:
        add in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the name of the header
        value - the value of the header
        Returns:
        this
      • add

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

        public T add​(K name,
                     V... values)
        Description copied from interface: Headers
        Adds new headers with the specified name and values. This method is semantically equivalent to
         for (T value : values) {
             headers.add(name, value);
         }
         
        Specified by:
        add in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        values - the values of the header
        Returns:
        this
      • addObject

        public T addObject​(K name,
                           Object value)
        Description copied from interface: Headers
        Adds a new header. Before the value is added, it's converted to type T.
        Specified by:
        addObject in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the value of the header
        Returns:
        this
      • addObject

        public T addObject​(K name,
                           Iterable<?> values)
        Description copied from interface: Headers
        Adds a new header with the specified name and values. This method is equivalent to
         for (Object v : values) {
             headers.addObject(name, v);
         }
         
        Specified by:
        addObject in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        values - the value of the header
        Returns:
        this
      • addObject

        public T addObject​(K name,
                           Object... values)
        Description copied from interface: Headers
        Adds a new header with the specified name and values. This method is equivalent to
         for (Object v : values) {
             headers.addObject(name, v);
         }
         
        Specified by:
        addObject in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        values - the value of the header
        Returns:
        this
      • addInt

        public T addInt​(K name,
                        int value)
        Description copied from interface: Headers
        Adds a new header.
        Specified by:
        addInt in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the value of the header
        Returns:
        this
      • addLong

        public T addLong​(K name,
                         long value)
        Description copied from interface: Headers
        Adds a new header.
        Specified by:
        addLong in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the value of the header
        Returns:
        this
      • addDouble

        public T addDouble​(K name,
                           double value)
        Description copied from interface: Headers
        Adds a new header.
        Specified by:
        addDouble in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the value of the header
        Returns:
        this
      • addTimeMillis

        public T addTimeMillis​(K name,
                               long value)
        Description copied from interface: Headers
        Adds a new header.
        Specified by:
        addTimeMillis in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the value of the header
        Returns:
        this
      • addChar

        public T addChar​(K name,
                         char value)
        Description copied from interface: Headers
        Adds a new header.
        Specified by:
        addChar in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the value of the header
        Returns:
        this
      • addBoolean

        public T addBoolean​(K name,
                            boolean value)
        Description copied from interface: Headers
        Adds a new header.
        Specified by:
        addBoolean in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the value of the header
        Returns:
        this
      • addFloat

        public T addFloat​(K name,
                          float value)
        Description copied from interface: Headers
        Adds a new header.
        Specified by:
        addFloat in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the value of the header
        Returns:
        this
      • addByte

        public T addByte​(K name,
                         byte value)
        Description copied from interface: Headers
        Adds a new header.
        Specified by:
        addByte in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the value of the header
        Returns:
        this
      • addShort

        public T addShort​(K name,
                          short value)
        Description copied from interface: Headers
        Adds a new header.
        Specified by:
        addShort in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the value of the header
        Returns:
        this
      • add

        public T add​(Headers<? extends K,​? extends V,​?> headers)
        Description copied from interface: Headers
        Adds all header names and values of headers to this object.
        Specified by:
        add in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Returns:
        this
      • addImpl

        protected void addImpl​(Headers<? extends K,​? extends V,​?> headers)
      • set

        public T set​(K name,
                     V value)
        Description copied from interface: Headers
        Sets a header with the specified name and value. Any existing headers with the same name are overwritten.
        Specified by:
        set in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the value of the header
        Returns:
        this
      • set

        public T set​(K name,
                     Iterable<? extends V> values)
        Description copied from interface: Headers
        Sets a new header with the specified name and values. This method is equivalent to
         for (T v : values) {
             headers.addObject(name, v);
         }
         
        Specified by:
        set in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        values - the value of the header
        Returns:
        this
      • set

        public T set​(K name,
                     V... values)
        Description copied from interface: Headers
        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);
         }
         
        Specified by:
        set in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        values - the value of the header
        Returns:
        this
      • setObject

        public T setObject​(K name,
                           Object value)
        Description copied from interface: Headers
        Sets a new header. Any existing headers with this name are removed. Before the value is add, it's converted to type T.
        Specified by:
        setObject in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        value - the value of the header
        Returns:
        this
      • setObject

        public T setObject​(K name,
                           Iterable<?> values)
        Description copied from interface: Headers
        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);
         }
         
        Specified by:
        setObject in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        values - the values of the header
        Returns:
        this
      • setObject

        public T setObject​(K name,
                           Object... values)
        Description copied from interface: Headers
        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);
         }
         
        Specified by:
        setObject in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        values - the values of the header
        Returns:
        this
      • setInt

        public T setInt​(K name,
                        int value)
        Description copied from interface: Headers
        Set the name to value. This will remove all previous values associated with name.
        Specified by:
        setInt in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - The name to modify
        value - The value
        Returns:
        this
      • setLong

        public T setLong​(K name,
                         long value)
        Description copied from interface: Headers
        Set the name to value. This will remove all previous values associated with name.
        Specified by:
        setLong in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - The name to modify
        value - The value
        Returns:
        this
      • setDouble

        public T setDouble​(K name,
                           double value)
        Description copied from interface: Headers
        Set the name to value. This will remove all previous values associated with name.
        Specified by:
        setDouble in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - The name to modify
        value - The value
        Returns:
        this
      • setTimeMillis

        public T setTimeMillis​(K name,
                               long value)
        Description copied from interface: Headers
        Set the name to value. This will remove all previous values associated with name.
        Specified by:
        setTimeMillis in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - The name to modify
        value - The value
        Returns:
        this
      • setFloat

        public T setFloat​(K name,
                          float value)
        Description copied from interface: Headers
        Set the name to value. This will remove all previous values associated with name.
        Specified by:
        setFloat in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - The name to modify
        value - The value
        Returns:
        this
      • setChar

        public T setChar​(K name,
                         char value)
        Description copied from interface: Headers
        Set the name to value. This will remove all previous values associated with name.
        Specified by:
        setChar in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - The name to modify
        value - The value
        Returns:
        this
      • setBoolean

        public T setBoolean​(K name,
                            boolean value)
        Description copied from interface: Headers
        Set the name to value. This will remove all previous values associated with name.
        Specified by:
        setBoolean in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - The name to modify
        value - The value
        Returns:
        this
      • setByte

        public T setByte​(K name,
                         byte value)
        Description copied from interface: Headers
        Set the name to value. This will remove all previous values associated with name.
        Specified by:
        setByte in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - The name to modify
        value - The value
        Returns:
        this
      • setShort

        public T setShort​(K name,
                          short value)
        Description copied from interface: Headers
        Set the name to value. This will remove all previous values associated with name.
        Specified by:
        setShort in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - The name to modify
        value - The value
        Returns:
        this
      • set

        public T set​(Headers<? extends K,​? extends V,​?> headers)
        Description copied from interface: Headers
        Clears the current header entries and copies all header entries of the specified headers.
        Specified by:
        set in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Returns:
        this
      • setAll

        public T setAll​(Headers<? extends K,​? extends V,​?> headers)
        Description copied from interface: Headers
        Retains all current headers but calls #set(K, V) for each entry in headers.
        Specified by:
        setAll in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        headers - The headers used to #set(K, V) values in this instance
        Returns:
        this
      • remove

        public boolean remove​(K name)
        Description copied from interface: Headers
        Removes all headers with the specified name.
        Specified by:
        remove in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Parameters:
        name - the header name
        Returns:
        true if at least one entry has been removed.
      • clear

        public T clear()
        Description copied from interface: Headers
        Removes all headers. After a call to this method Headers.size() equals 0.
        Specified by:
        clear in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        Returns:
        this
      • getBoolean

        public Boolean getBoolean​(K name)
        Description copied from interface: Headers
        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.
        Specified by:
        getBoolean in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public boolean getBoolean​(K name,
                                  boolean defaultValue)
        Description copied from interface: Headers
        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.
        Specified by:
        getBoolean in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public Byte getByte​(K name)
        Description copied from interface: Headers
        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.
        Specified by:
        getByte in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public byte getByte​(K name,
                            byte defaultValue)
        Description copied from interface: Headers
        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.
        Specified by:
        getByte in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public Character getChar​(K name)
        Description copied from interface: Headers
        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.
        Specified by:
        getChar in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public char getChar​(K name,
                            char defaultValue)
        Description copied from interface: Headers
        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.
        Specified by:
        getChar in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public Short getShort​(K name)
        Description copied from interface: Headers
        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.
        Specified by:
        getShort in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public short getShort​(K name,
                              short defaultValue)
        Description copied from interface: Headers
        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.
        Specified by:
        getShort in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public Integer getInt​(K name)
        Description copied from interface: Headers
        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.
        Specified by:
        getInt in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public int getInt​(K name,
                          int defaultValue)
        Description copied from interface: Headers
        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.
        Specified by:
        getInt in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public Long getLong​(K name)
        Description copied from interface: Headers
        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.
        Specified by:
        getLong in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public long getLong​(K name,
                            long defaultValue)
        Description copied from interface: Headers
        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.
        Specified by:
        getLong in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public Float getFloat​(K name)
        Description copied from interface: Headers
        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.
        Specified by:
        getFloat in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public float getFloat​(K name,
                              float defaultValue)
        Description copied from interface: Headers
        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.
        Specified by:
        getFloat in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public Double getDouble​(K name)
        Description copied from interface: Headers
        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.
        Specified by:
        getDouble in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public double getDouble​(K name,
                                double defaultValue)
        Description copied from interface: Headers
        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.
        Specified by:
        getDouble in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public Long getTimeMillis​(K name)
        Description copied from interface: Headers
        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.
        Specified by:
        getTimeMillis in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public long getTimeMillis​(K name,
                                  long defaultValue)
        Description copied from interface: Headers
        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.
        Specified by:
        getTimeMillis in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public Boolean getBooleanAndRemove​(K name)
        Description copied from interface: Headers
        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.

        Specified by:
        getBooleanAndRemove in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public boolean getBooleanAndRemove​(K name,
                                           boolean defaultValue)
        Description copied from interface: Headers
        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.

        Specified by:
        getBooleanAndRemove in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public Byte getByteAndRemove​(K name)
        Description copied from interface: Headers
        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.

        Specified by:
        getByteAndRemove in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public byte getByteAndRemove​(K name,
                                     byte defaultValue)
        Description copied from interface: Headers
        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.

        Specified by:
        getByteAndRemove in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public Character getCharAndRemove​(K name)
        Description copied from interface: Headers
        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.

        Specified by:
        getCharAndRemove in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public char getCharAndRemove​(K name,
                                     char defaultValue)
        Description copied from interface: Headers
        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.

        Specified by:
        getCharAndRemove in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public Short getShortAndRemove​(K name)
        Description copied from interface: Headers
        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.

        Specified by:
        getShortAndRemove in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public short getShortAndRemove​(K name,
                                       short defaultValue)
        Description copied from interface: Headers
        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.

        Specified by:
        getShortAndRemove in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public Integer getIntAndRemove​(K name)
        Description copied from interface: Headers
        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.

        Specified by:
        getIntAndRemove in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public int getIntAndRemove​(K name,
                                   int defaultValue)
        Description copied from interface: Headers
        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.

        Specified by:
        getIntAndRemove in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public Long getLongAndRemove​(K name)
        Description copied from interface: Headers
        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.

        Specified by:
        getLongAndRemove in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public long getLongAndRemove​(K name,
                                     long defaultValue)
        Description copied from interface: Headers
        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.

        Specified by:
        getLongAndRemove in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public Float getFloatAndRemove​(K name)
        Description copied from interface: Headers
        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.

        Specified by:
        getFloatAndRemove in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public float getFloatAndRemove​(K name,
                                       float defaultValue)
        Description copied from interface: Headers
        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.

        Specified by:
        getFloatAndRemove in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public Double getDoubleAndRemove​(K name)
        Description copied from interface: Headers
        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.

        Specified by:
        getDoubleAndRemove in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public double getDoubleAndRemove​(K name,
                                         double defaultValue)
        Description copied from interface: Headers
        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.

        Specified by:
        getDoubleAndRemove in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public Long getTimeMillisAndRemove​(K name)
        Description copied from interface: Headers
        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.

        Specified by:
        getTimeMillisAndRemove in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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

        public long getTimeMillisAndRemove​(K name,
                                           long defaultValue)
        Description copied from interface: Headers
        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.

        Specified by:
        getTimeMillisAndRemove in interface Headers<K,​V,​T extends Headers<K,​V,​T>>
        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.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public final boolean equals​(Headers<K,​V,​?> h2,
                                    HashingStrategy<V> valueHashingStrategy)
        Test this object for equality against h2.
        Parameters:
        h2 - The object to check equality for.
        valueHashingStrategy - Defines how values will be compared for equality.
        Returns:
        true if this object equals h2 given valueHashingStrategy. false otherwise.
      • hashCode

        public final int hashCode​(HashingStrategy<V> valueHashingStrategy)
        Generate a hash code for this object given a HashingStrategy to generate hash codes for individual values.
        Parameters:
        valueHashingStrategy - Defines how values will be hashed.
      • copy

        public DefaultHeaders<K,​V,​T> copy()
        Returns a deep copy of this instance.