Package org.jdrupes.httpcodec.types
Interface MultiValueConverter<T extends Iterable<V>,V>
- Type Parameters:
T
- the container for the valuesV
- the type of the values
- All Superinterfaces:
Converter<T>
- All Known Implementing Classes:
DefaultMultiValueConverter
Implemented by converters that convert header fields with a list of values.
Minimal restrictions are imposed on the type used as container for the
values. It must be Iterable
to provide read access. A supplier
and a function for appending values provide the required write access.
-
Method Summary
Modifier and TypeMethodDescriptiondefault String
asHeaderField
(String fieldName, T value) Returns the string representation of this header field as it appears in an HTTP message.Returns the container supplierboolean
Return whether values should be converted to separate header fields inConverter.asFieldValue(Object)
.BiConsumer<T,
V> Returns the value adderDeprecated.valueConverter
(T value) Returns the value converter.Methods inherited from interface org.jdrupes.httpcodec.types.Converter
asFieldValue, fromFieldValue
-
Method Details
-
containerSupplier
Returns the container supplier- Returns:
- the container supplier
-
valueAdder
BiConsumer<T,V> valueAdder()Returns the value adder- Returns:
- the value adder
-
valueConverter
Deprecated.UsevalueConverter(Iterable)
instead.Returns the value converter.- Returns:
- the value converter
-
valueConverter
Returns the value converter.In most cases, the result will be independent of the container type or instance. However, passing it makes the selection more flexible.
- Returns:
- the value converter
-
separateValues
boolean separateValues()Return whether values should be converted to separate header fields inConverter.asFieldValue(Object)
.- Returns:
- the value
-
asHeaderField
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.- Specified by:
asHeaderField
in interfaceConverter<T extends Iterable<V>>
- Parameters:
fieldName
- the field namevalue
- the value- Returns:
- the field as it occurs in a header
-
valueConverter(Iterable)
instead.