V
- The generic valuepublic interface ConvertibleValues<V> extends ValueResolver<java.lang.CharSequence>, java.lang.Iterable<java.util.Map.Entry<java.lang.String,V>>
Modifier and Type | Field and Description |
---|---|
static ConvertibleValues |
EMPTY |
Modifier and Type | Method and 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()
An empty
ConvertibleValues . |
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,
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,
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,
java.lang.Class<V> valueType)
Returns a submap for all the keys with the given prefix.
|
java.util.Collection<V> |
values() |
get, get, get, get
static final ConvertibleValues EMPTY
java.util.Set<java.lang.String> names()
java.util.Collection<V> values()
default boolean isEmpty()
default java.lang.Class<V> getValueType()
default boolean contains(java.lang.String name)
name
- The key name@Nullable default V getValue(java.lang.CharSequence name)
name
- The key namedefault void forEach(java.util.function.BiConsumer<java.lang.String,V> action)
action
- The action to be performed for each entryjava.lang.NullPointerException
- if the specified action is nulldefault java.util.Map<java.lang.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> java.util.Map<KT,VT> asMap(java.lang.Class<KT> keyType, java.lang.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 java.util.Properties asProperties()
ConvertibleValues
as a Properties
object returning only keys and values that
can be represented as a string.default java.util.Map<java.lang.String,V> subMap(java.lang.String prefix, java.lang.Class<V> valueType)
prefix
- The prefixvalueType
- The value typedefault java.util.Map<java.lang.String,V> subMap(java.lang.String prefix, Argument<V> valueType)
prefix
- The prefixvalueType
- The value typedefault java.util.Map<java.lang.String,V> subMap(java.lang.String prefix, ArgumentConversionContext<V> valueType)
prefix
- The prefixvalueType
- The value typedefault java.util.Iterator<java.util.Map.Entry<java.lang.String,V>> iterator()
iterator
in interface java.lang.Iterable<java.util.Map.Entry<java.lang.String,V>>
static <T> ConvertibleValues<T> of(java.util.Map<? extends java.lang.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