Interface ConvertibleValues<V>

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default java.util.Map<java.lang.String,​V> asMap()
      Return this ConvertibleValues as a map for the given key type and value type.
      default <KT,​VT>
      java.util.Map<KT,​VT>
      asMap​(java.lang.Class<KT> keyType, java.lang.Class<VT> valueType)
      Return this ConvertibleValues as a map for the given key type and value type.
      default java.util.Properties asProperties()
      Return this ConvertibleValues as a Properties object returning only keys and values that can be represented as a string.
      default boolean contains​(java.lang.String name)
      Whether the given key is contained within these values.
      static <V> ConvertibleValues<V> empty()
      default void forEach​(java.util.function.BiConsumer<java.lang.String,​V> action)
      Performs the given action for each value.
      default V getValue​(java.lang.CharSequence name)
      Get a raw value without any conversion.
      default java.lang.Class<V> getValueType()  
      default boolean isEmpty()  
      default java.util.Iterator<java.util.Map.Entry<java.lang.String,​V>> iterator()  
      java.util.Set<java.lang.String> names()  
      static <T> ConvertibleValues<T> of​(java.util.Map<? extends java.lang.CharSequence,​T> values)
      Creates a new ConvertibleValues for the values.
      default java.util.Map<java.lang.String,​V> subMap​(java.lang.String prefix, ArgumentConversionContext<V> valueType)
      Returns a submap for all the keys with the given prefix.
      default java.util.Map<java.lang.String,​V> subMap​(java.lang.String prefix, Argument<V> valueType)
      Returns a submap for all the keys with the given prefix.
      default java.util.Map<java.lang.String,​V> subMap​(java.lang.String prefix, java.lang.Class<V> valueType)
      Returns a submap for all the keys with the given prefix.
      java.util.Collection<V> values()  
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Method Detail

      • names

        java.util.Set<java.lang.String> names()
        Returns:
        The names of the values
      • values

        java.util.Collection<V> values()
        Returns:
        The values
      • isEmpty

        default boolean isEmpty()
        Returns:
        Whether this values is empty
      • getValueType

        default java.lang.Class<V> getValueType()
        Returns:
        The concrete type of the value
      • contains

        default boolean contains​(java.lang.String name)
        Whether the given key is contained within these values.
        Parameters:
        name - The key name
        Returns:
        True if it is
      • getValue

        @Nullable
        default V getValue​(java.lang.CharSequence name)
        Get a raw value without any conversion.
        Parameters:
        name - The key name
        Returns:
        True if it is
        Since:
        2.0.0
      • forEach

        default void forEach​(java.util.function.BiConsumer<java.lang.String,​V> action)
        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.
        Parameters:
        action - The action to be performed for each entry
        Throws:
        java.lang.NullPointerException - if the specified action is null
        Since:
        1.0
      • asMap

        default java.util.Map<java.lang.String,​V> asMap()
        Return this ConvertibleValues as a map for the given key type and value type. The map represents a copy of the data held by this instance.
        Returns:
        The values
      • asMap

        default <KT,​VT> java.util.Map<KT,​VT> asMap​(java.lang.Class<KT> keyType,
                                                               java.lang.Class<VT> valueType)
        Return this ConvertibleValues as a map for the given key type and value type. If any entry cannot be converted to the target key/value type then the entry is simply excluded, hence the size of the map returned may not match the size of this ConvertibleValues.
        Type Parameters:
        KT - The key type
        VT - The value type
        Parameters:
        keyType - The key type
        valueType - The value type
        Returns:
        The values with the key converted to the given key type and the value to the given value type.
      • asProperties

        default java.util.Properties asProperties()
        Return this ConvertibleValues as a Properties object returning only keys and values that can be represented as a string.
        Returns:
        The values with the key converted to the given key type and the value to the given value type.
        Since:
        1.0.3
      • subMap

        default java.util.Map<java.lang.String,​V> subMap​(java.lang.String prefix,
                                                               java.lang.Class<V> valueType)
        Returns a submap for all the keys with the given prefix.
        Parameters:
        prefix - The prefix
        valueType - The value type
        Returns:
        The submap
      • subMap

        default java.util.Map<java.lang.String,​V> subMap​(java.lang.String prefix,
                                                               Argument<V> valueType)
        Returns a submap for all the keys with the given prefix.
        Parameters:
        prefix - The prefix
        valueType - The value type
        Returns:
        The submap
      • subMap

        default java.util.Map<java.lang.String,​V> subMap​(java.lang.String prefix,
                                                               ArgumentConversionContext<V> valueType)
        Returns a submap for all the keys with the given prefix.
        Parameters:
        prefix - The prefix
        valueType - The value type
        Returns:
        The submap
      • iterator

        default java.util.Iterator<java.util.Map.Entry<java.lang.String,​V>> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<V>
      • of

        static <T> ConvertibleValues<T> of​(java.util.Map<? extends java.lang.CharSequence,​T> values)
        Creates a new ConvertibleValues for the values.
        Type Parameters:
        T - The target generic type
        Parameters:
        values - A map of values
        Returns:
        The values