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
FieldsFields inherited from interface io.micronaut.core.convert.value.ConvertibleValues
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.ConvertibleValuesMap(Map<? extends CharSequence, V> map) Constructor.ConvertibleValuesMap(Map<? extends CharSequence, V> map, ConversionService conversionService) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether the given key is contained within these values.static <V> ConvertibleValues<V>empty()An emptyConvertibleValuesMap.booleanvoidforEach(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.inthashCode()names()voidsetConversionService(ConversionService conversionService) Sets the conversion service.values()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.core.convert.value.ConvertibleValues
asMap, asMap, asProperties, getConversionService, getValueType, isEmpty, iterator, subMap, subMap, subMapMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods 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:ConvertibleValuesGet a raw value without any conversion.- Specified by:
getValuein interfaceConvertibleValues<V>- Parameters:
name- The key name- Returns:
- True if it is
-
contains
Description copied from interface:ConvertibleValuesWhether the given key is contained within these values.- Specified by:
containsin interfaceConvertibleValues<V>- Parameters:
name- The key name- Returns:
- True if it is
-
get
Description copied from interface:ValueResolverResolve the given property for the given name.- Specified by:
getin 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:
namesin interfaceConvertibleValues<V>- Returns:
- The names of the values
-
values
- Specified by:
valuesin 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:ConversionServiceAwareSets the conversion service.- Specified by:
setConversionServicein interfaceConversionServiceAware- Parameters:
conversionService- The conversion service
-
forEach
Description copied from interface:ConvertibleValuesPerforms 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:
forEachin interfaceConvertibleValues<V>- Parameters:
action- The action to be performed for each entry
-