Interface ConvertibleMultiValues<V>

Type Parameters:
V - The generic value
All Superinterfaces:
ConversionServiceProvider, ConvertibleValues<List<V>>, Iterable<Map.Entry<String,List<V>>>, ValueResolver<CharSequence>
All Known Subinterfaces:
Headers, HttpHeaders, HttpParameters, MessageHeaders, MutableConvertibleMultiValues<V>, MutableHeaders, MutableHttpHeaders, MutableHttpParameters
All Known Implementing Classes:
CaseInsensitiveMutableHttpHeaders, ConvertibleMultiValuesMap, HttpHeadersAdapter, MutableConvertibleMultiValuesMap, NettyHttpHeaders, NettyHttpParameters, SimpleHttpHeaders, SimpleHttpParameters

public interface ConvertibleMultiValues<V> extends ConvertibleValues<List<V>>
Specialization of ConvertibleValues where each name has multiple possible values.
Since:
1.0
Author:
Graeme Rocher
  • Method Details

    • getAll

      List<V> getAll(CharSequence name)
      Get all the values for the given name without applying conversion.
      Parameters:
      name - The header name
      Returns:
      All the values
    • get

      Get a value without applying any conversion.
      Parameters:
      name - The name of the value
      Returns:
      The raw value or null
      See Also:
    • isEmpty

      default boolean isEmpty()
      Specified by:
      isEmpty in interface ConvertibleValues<V>
      Returns:
      Whether these values are empty
    • forEachValue

      default void forEachValue(BiConsumer<String,V> action)
      Performs the given action for each header. Note that in the case where multiple values exist for the same header then the consumer will be invoked multiple times for the same key.
      Parameters:
      action - The action to be performed for each entry
      Throws:
      NullPointerException - if the specified action is null
      Since:
      1.0
    • forEach

      default void forEach(BiConsumer<String,List<V>> action)
      Description copied from interface: ConvertibleValues
      Performs the given action for each value. Note that in the case where multiple values exist for the same header then the consumer will be invoked multiple times for the same key.
      Specified by:
      forEach in interface ConvertibleValues<V>
      Parameters:
      action - The action to be performed for each entry
    • iterator

      default Iterator<Map.Entry<String,List<V>>> iterator()
      Specified by:
      iterator in interface ConvertibleValues<V>
      Specified by:
      iterator in interface Iterable<V>
    • getFirst

      default Optional<V> getFirst(CharSequence name)
      Get the first value of the given header.
      Parameters:
      name - The header name
      Returns:
      The first value or null if it is present
    • getFirst

      default <T> Optional<T> getFirst(CharSequence name, Class<T> requiredType)
      Find a header and convert it to the given type.
      Type Parameters:
      T - The generic type
      Parameters:
      name - The name of the header
      requiredType - The required type
      Returns:
      If the header is presented and can be converted an optional of the value otherwise Optional.empty()
    • getFirst

      default <T> Optional<T> getFirst(CharSequence name, Argument<T> requiredType)
      Find a header and convert it to the given type.
      Type Parameters:
      T - The generic type
      Parameters:
      name - The name of the header
      requiredType - The required type
      Returns:
      If the header is presented and can be converted an optional of the value otherwise Optional.empty()
    • getFirst

      default <T> Optional<T> getFirst(CharSequence name, ArgumentConversionContext<T> conversionContext)
      Find a header and convert it to the given type.
      Type Parameters:
      T - The generic type
      Parameters:
      name - The name of the header
      conversionContext - The conversion context
      Returns:
      If the header is presented and can be converted an optional of the value otherwise Optional.empty()
    • getFirst

      default <T> T getFirst(CharSequence name, Class<T> requiredType, T defaultValue)
      Find a header and convert it to the given type.
      Type Parameters:
      T - The generic type
      Parameters:
      name - The name of the header
      requiredType - The required type
      defaultValue - The default value
      Returns:
      The first value of the default supplied value if it is present
    • of

      static <T> ConvertibleMultiValues<T> of(Map<CharSequence,List<T>> values)
      Creates a new OptionalValues for the given type and values.
      Type Parameters:
      T - The target generic type
      Parameters:
      values - A map of values
      Returns:
      The values
    • empty

      static <V> ConvertibleMultiValues<V> empty()
      Type Parameters:
      V - The generic type
      Returns:
      The empty ConvertibleValues