Interface Header

All Known Implementing Classes:
HeaderImpl

public interface Header
  • Method Details

    • of

      @NotNull static @NotNull Header of(@NotNull @NotNull String header)
      Create new Header.
      Parameters:
      header - header string with the following format: "key: value"
      Returns:
      new Header.
    • of

      @NotNull static @NotNull Header of(@NotNull @NotNull String key, @NotNull @NotNull String value)
      Create new Header.
      Parameters:
      key - header key
      value - header value
      Returns:
      new Header
    • getKey

      @NotNull @NotNull String getKey()
      Key of this Header.
      Returns:
      key as String
    • getValue

      @NotNull @NotNull String getValue()
      Value of this Header.
      Returns:
      value as String
    • parseValue

      @NotNull default <T> T parseValue(@NotNull @NotNull HeaderValueParser<T> parser)
      parse this headers value using given parser
      Type Parameters:
      T - class to parse to
      Parameters:
      parser - HeaderValueParser
      Returns:
      parsed header value
      See Also:
    • asString

      @NotNull default @NotNull String asString()
      This header as String.
      Returns:
      this header
    • equals

      static boolean equals(Header header, Object other)
      Checks getKey() and getValue() of both headers and ignores case.
      Parameters:
      header - Header to compare
      other - object to check if it represents the same Header as given header.
      Returns:
      true if both headers have the same key and value (ignores case)
    • hashCode

      static int hashCode(Header header)
      Generate the hashcode for a Header implementation
      Parameters:
      header - the Header to generate the hashcode for
      Returns:
      hashcode