Interface Converter<T>

Type Parameters:
T - the type to be converted
All Known Subinterfaces:
MultiValueConverter<T,V>
All Known Implementing Classes:
CommentedValue.CommentedValueConverter, DefaultMultiValueConverter, Directive.DirectiveConverter, Etag.EtagConverter, InstantConverter, MediaBase.MediaTypePairConverter, MediaRange.MediaRangeConverter, MediaType.MediaTypeConverter, ParameterizedValue.ParameterizedValueConverter, ParameterizedValue.ParamValueConverterBase, SetCookieStringConverter

public interface Converter<T>
Implemented by classes that convert between a value and its string representation in the HTTP header field.
  • Method Summary

    Modifier and Type
    Method
    Description
    asFieldValue(T value)
    Returns the representation of this value in a header field.
    default String
    asHeaderField(String fieldName, T value)
    Returns the string representation of this header field as it appears in an HTTP message.
    Parses the given text and returns the parsed value.
  • Method Details

    • asFieldValue

      Returns the representation of this value in a header field.
      Parameters:
      value - the value to be converted
      Returns:
      the representation
    • asHeaderField

      default String asHeaderField(String fieldName, T value)
      Returns the string representation of this header field as it appears in an HTTP message.

      Note that the returned string may span several lines (may contain CR/LF), if the converter is a MultiValueConverter with separate values, but never has a trailing CR/LF.

      Parameters:
      fieldName - the field name
      value - the value
      Returns:
      the field as it occurs in a header
    • fromFieldValue

      Parses the given text and returns the parsed value.
      Parameters:
      text - the value from the header field
      Returns:
      the parsed value
      Throws:
      ParseException - if the value cannot be parsed