Package io.micronaut.core.convert.value
Class ConvertibleMultiValuesMap<V>
java.lang.Object
io.micronaut.core.convert.value.ConvertibleMultiValuesMap<V>
- Type Parameters:
V
- The generic value
- All Implemented Interfaces:
ConversionServiceAware
,ConversionServiceProvider
,ConvertibleMultiValues<V>
,ConvertibleValues<List<V>>
,ValueResolver<CharSequence>
,Iterable<Map.Entry<String,
List<V>>>
- Direct Known Subclasses:
MutableConvertibleMultiValuesMap
public class ConvertibleMultiValuesMap<V>
extends Object
implements ConvertibleMultiValues<V>, ConversionServiceAware
An implementation of
ConvertibleMultiValues
that uses a backing LinkedHashMap
.- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
Modifier and TypeFieldDescriptionstatic final ConvertibleMultiValues
protected final Map<CharSequence,
List<V>> -
Constructor Summary
ConstructorDescriptionConstruct an emptyConvertibleValuesMap
.ConvertibleMultiValuesMap
(Map<CharSequence, List<V>> values) Construct aConvertibleValuesMap
from the given map.ConvertibleMultiValuesMap
(Map<CharSequence, List<V>> values, ConversionService conversionService) Construct aConvertibleValuesMap
from the given map and conversion service. -
Method Summary
Modifier and TypeMethodDescriptionboolean
get
(CharSequence name) Get a value without applying any conversion.<T> Optional<T>
get
(CharSequence name, ArgumentConversionContext<T> conversionContext) Resolve the given property for the given name.getAll
(CharSequence name) Get all the values for the given name without applying conversion.Provides the conversion service.int
hashCode()
names()
void
setConversionService
(ConversionService conversionService) Sets the conversion service.Collection<List<V>>
values()
protected Map<CharSequence,
List<V>> wrapValues
(Map<CharSequence, List<V>> values) Wraps the values (by default in an unmodifiable map).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.ConvertibleMultiValues
forEach, forEachValue, getFirst, getFirst, getFirst, getFirst, getFirst, isEmpty, iterator
Methods inherited from interface io.micronaut.core.convert.value.ConvertibleValues
asMap, asMap, asProperties, contains, getValue, getValueType, 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
-
EMPTY
-
values
-
-
Constructor Details
-
ConvertibleMultiValuesMap
public ConvertibleMultiValuesMap()Construct an emptyConvertibleValuesMap
. -
ConvertibleMultiValuesMap
Construct aConvertibleValuesMap
from the given map.- Parameters:
values
- The map
-
ConvertibleMultiValuesMap
public ConvertibleMultiValuesMap(Map<CharSequence, List<V>> values, ConversionService conversionService) Construct aConvertibleValuesMap
from the given map and conversion service.- Parameters:
values
- The mapconversionService
- The conversion service
-
-
Method Details
-
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
-
getAll
Description copied from interface:ConvertibleMultiValues
Get all the values for the given name without applying conversion.- Specified by:
getAll
in interfaceConvertibleMultiValues<V>
- Parameters:
name
- The header name- Returns:
- All the values
-
get
Description copied from interface:ConvertibleMultiValues
Get a value without applying any conversion.- Specified by:
get
in interfaceConvertibleMultiValues<V>
- Parameters:
name
- The name of the value- Returns:
- The raw value or null
- See Also:
-
names
- Specified by:
names
in interfaceConvertibleValues<V>
- Returns:
- The names of the values
-
values
- Specified by:
values
in interfaceConvertibleValues<V>
- Returns:
- The values
-
wrapValues
Wraps the values (by default in an unmodifiable map).- Parameters:
values
- The values- Returns:
- The wrapped values.
-
equals
-
hashCode
public int hashCode() -
getConversionService
Description copied from interface:ConversionServiceProvider
Provides the conversion service.- Specified by:
getConversionService
in interfaceConversionServiceProvider
- Specified by:
getConversionService
in interfaceConvertibleValues<V>
- Returns:
- the conversion service
-
setConversionService
Description copied from interface:ConversionServiceAware
Sets the conversion service.- Specified by:
setConversionService
in interfaceConversionServiceAware
- Parameters:
conversionService
- The conversion service
-