V
- The generic valuepublic interface ConvertibleValues<V> extends ValueResolver<CharSequence>, Iterable<Map.Entry<String,V>>
Modifier and Type | Field and Description |
---|---|
static ConvertibleValues |
EMPTY |
Modifier and Type | Method and Description |
---|---|
default Map<String,V> |
asMap()
Return this
ConvertibleValues as a map for the given key type and value type. |
default <KT,VT> Map<KT,VT> |
asMap(Class<KT> keyType,
Class<VT> valueType)
Return this
ConvertibleValues as a map for the given key type and value type. |
default Properties |
asProperties()
Return this
ConvertibleValues as a Properties object returning only keys and values that
can be represented as a string. |
default boolean |
contains(String name)
Whether the given key is contained within these values.
|
static <V> ConvertibleValues<V> |
empty()
An empty
ConvertibleValues . |
default void |
forEach(BiConsumer<String,V> action)
Performs the given action for each value.
|
default V |
getValue(CharSequence name)
Get a raw value without any conversion.
|
default Class<V> |
getValueType() |
default boolean |
isEmpty() |
default Iterator<Map.Entry<String,V>> |
iterator() |
Set<String> |
names() |
static <T> ConvertibleValues<T> |
of(Map<? extends CharSequence,T> values)
Creates a new
ConvertibleValues for the values. |
default Map<String,V> |
subMap(String prefix,
Argument<V> valueType)
Returns a submap for all the keys with the given prefix.
|
default Map<String,V> |
subMap(String prefix,
ArgumentConversionContext<V> valueType)
Returns a submap for all the keys with the given prefix.
|
default Map<String,V> |
subMap(String prefix,
Class<V> valueType)
Returns a submap for all the keys with the given prefix.
|
Collection<V> |
values() |
get, get, get, get
forEach, spliterator
static final ConvertibleValues EMPTY
Collection<V> values()
default boolean isEmpty()
default boolean contains(String name)
name
- The key name@Nullable default V getValue(CharSequence name)
name
- The key namedefault void forEach(BiConsumer<String,V> action)
action
- The action to be performed for each entryNullPointerException
- if the specified action is nulldefault Map<String,V> asMap()
ConvertibleValues
as a map for the given key type and value type. The map represents a copy of the data held by this instance.default <KT,VT> Map<KT,VT> asMap(Class<KT> keyType, Class<VT> valueType)
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
.KT
- The key typeVT
- The value typekeyType
- The key typevalueType
- The value typedefault Properties asProperties()
ConvertibleValues
as a Properties
object returning only keys and values that
can be represented as a string.default Map<String,V> subMap(String prefix, Class<V> valueType)
prefix
- The prefixvalueType
- The value typedefault Map<String,V> subMap(String prefix, Argument<V> valueType)
prefix
- The prefixvalueType
- The value typedefault Map<String,V> subMap(String prefix, ArgumentConversionContext<V> valueType)
prefix
- The prefixvalueType
- The value typestatic <T> ConvertibleValues<T> of(Map<? extends CharSequence,T> values)
ConvertibleValues
for the values.T
- The target generic typevalues
- A map of valuesstatic <V> ConvertibleValues<V> empty()
ConvertibleValues
.V
- The generic typeConvertibleValues