Interface ConvertibleMultiValues<V>

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      static <V> ConvertibleMultiValues<V> empty()
      default void forEach​(java.util.function.BiConsumer<java.lang.String,​java.util.List<V>> action)
      Performs the given action for each value.
      default void forEachValue​(java.util.function.BiConsumer<java.lang.String,​V> action)
      Performs the given action for each header.
      V get​(java.lang.CharSequence name)
      Get a value without applying any conversion.
      java.util.List<V> getAll​(java.lang.CharSequence name)
      Get all the values for the given name without applying conversion.
      default java.util.Optional<V> getFirst​(java.lang.CharSequence name)
      Get the first value of the given header.
      default <T> java.util.Optional<T> getFirst​(java.lang.CharSequence name, ArgumentConversionContext<T> conversionContext)
      Find a header and convert it to the given type.
      default <T> java.util.Optional<T> getFirst​(java.lang.CharSequence name, Argument<T> requiredType)
      Find a header and convert it to the given type.
      default <T> java.util.Optional<T> getFirst​(java.lang.CharSequence name, java.lang.Class<T> requiredType)
      Find a header and convert it to the given type.
      default <T> T getFirst​(java.lang.CharSequence name, java.lang.Class<T> requiredType, T defaultValue)
      Find a header and convert it to the given type.
      default boolean isEmpty()  
      default java.util.Iterator<java.util.Map.Entry<java.lang.String,​java.util.List<V>>> iterator()  
      static <T> ConvertibleMultiValues<T> of​(java.util.Map<java.lang.CharSequence,​java.util.List<T>> values)
      Creates a new OptionalValues for the given type and values.
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Method Detail

      • getAll

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

        @Nullable
        V get​(java.lang.CharSequence name)
        Get a value without applying any conversion.
        Parameters:
        name - The name of the value
        Returns:
        The raw value or null
        See Also:
        getFirst(CharSequence)
      • isEmpty

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

        default void forEachValue​(java.util.function.BiConsumer<java.lang.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:
        java.lang.NullPointerException - if the specified action is null
        Since:
        1.0
      • forEach

        default void forEach​(java.util.function.BiConsumer<java.lang.String,​java.util.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 java.util.Iterator<java.util.Map.Entry<java.lang.String,​java.util.List<V>>> iterator()
        Specified by:
        iterator in interface ConvertibleValues<V>
        Specified by:
        iterator in interface java.lang.Iterable<V>
      • getFirst

        default java.util.Optional<V> getFirst​(java.lang.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> java.util.Optional<T> getFirst​(java.lang.CharSequence name,
                                                   java.lang.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> java.util.Optional<T> getFirst​(java.lang.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> java.util.Optional<T> getFirst​(java.lang.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​(java.lang.CharSequence name,
                               java.lang.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 isn't present
      • of

        static <T> ConvertibleMultiValues<T> of​(java.util.Map<java.lang.CharSequence,​java.util.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