Package io.micronaut.core.convert.value
Class ConvertibleValuesMap<V>
java.lang.Object
io.micronaut.core.convert.value.ConvertibleValuesMap<V>
- Type Parameters:
V
- generic value
- All Implemented Interfaces:
ConversionServiceAware
,ConversionServiceProvider
,ConvertibleValues<V>
,ValueResolver<CharSequence>
,Iterable<Map.Entry<String,
V>>
- Direct Known Subclasses:
MutableConvertibleValuesMap
public class ConvertibleValuesMap<V>
extends Object
implements ConvertibleValues<V>, ConversionServiceAware
An implementation of
ConvertibleValues
backed by a map.- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
Fields inherited from interface io.micronaut.core.convert.value.ConvertibleValues
EMPTY
-
Constructor Summary
ConstructorDescriptionConstructor.ConvertibleValuesMap
(Map<? extends CharSequence, V> map) Constructor.ConvertibleValuesMap
(Map<? extends CharSequence, V> map, ConversionService conversionService) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Whether the given key is contained within these values.static <V> ConvertibleValues<V>
empty()
An emptyConvertibleValuesMap
.boolean
void
forEach
(BiConsumer<String, V> action) Performs the given action for each value.<T> Optional<T>
get
(CharSequence name, ArgumentConversionContext<T> conversionContext) Resolve the given property for the given name.getValue
(CharSequence name) Get a raw value without any conversion.int
hashCode()
names()
void
setConversionService
(ConversionService conversionService) Sets the conversion service.values()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.core.convert.value.ConvertibleValues
asMap, asMap, asProperties, getConversionService, getValueType, isEmpty, iterator, subMap, subMap, subMap
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface io.micronaut.core.value.ValueResolver
get, get, get
-
Field Details
-
map
-
-
Constructor Details
-
ConvertibleValuesMap
public ConvertibleValuesMap()Constructor. -
ConvertibleValuesMap
Constructor.- Parameters:
map
- map of values.
-
ConvertibleValuesMap
Constructor.- Parameters:
map
- map of values.conversionService
- conversionService
-
-
Method Details
-
getValue
Description copied from interface:ConvertibleValues
Get a raw value without any conversion.- Specified by:
getValue
in interfaceConvertibleValues<V>
- Parameters:
name
- The key name- Returns:
- True if it is
-
contains
Description copied from interface:ConvertibleValues
Whether the given key is contained within these values.- Specified by:
contains
in interfaceConvertibleValues<V>
- Parameters:
name
- The key name- Returns:
- True if it is
-
get
Description copied from interface:ValueResolver
Resolve the given property for the given name.- Specified by:
get
in interfaceValueResolver<V>
- Type Parameters:
T
- The concrete type- Parameters:
name
- The nameconversionContext
- The conversion context- Returns:
- An optional containing the property value if it exists and is able to be converted
-
names
- Specified by:
names
in interfaceConvertibleValues<V>
- Returns:
- The names of the values
-
values
- Specified by:
values
in interfaceConvertibleValues<V>
- Returns:
- The values
-
empty
An emptyConvertibleValuesMap
.- Type Parameters:
V
- The generic type- Returns:
- The empty
ConvertibleValuesMap
-
equals
-
hashCode
public int hashCode() -
setConversionService
Description copied from interface:ConversionServiceAware
Sets the conversion service.- Specified by:
setConversionService
in interfaceConversionServiceAware
- Parameters:
conversionService
- The conversion service
-
forEach
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 interfaceConvertibleValues<V>
- Parameters:
action
- The action to be performed for each entry
-