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:
ConvertibleMultiValues<V>
,ConvertibleValues<java.util.List<V>>
,ValueResolver<java.lang.CharSequence>
,java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.util.List<V>>>
- Direct Known Subclasses:
MutableConvertibleMultiValuesMap
public class ConvertibleMultiValuesMap<V> extends java.lang.Object implements ConvertibleMultiValues<V>
An implementation ofConvertibleMultiValues
that uses a backingLinkedHashMap
.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description static ConvertibleMultiValues
EMPTY
protected java.util.Map<java.lang.CharSequence,java.util.List<V>>
values
-
Constructor Summary
Constructors Constructor Description ConvertibleMultiValuesMap()
Construct an emptyConvertibleValuesMap
.ConvertibleMultiValuesMap(java.util.Map<java.lang.CharSequence,java.util.List<V>> values)
Construct aConvertibleValuesMap
from the given map.ConvertibleMultiValuesMap(java.util.Map<java.lang.CharSequence,java.util.List<V>> values, ConversionService<?> conversionService)
Construct aConvertibleValuesMap
from the given map and conversion service.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
V
get(java.lang.CharSequence name)
Get a value without applying any conversion.<T> java.util.Optional<T>
get(java.lang.CharSequence name, ArgumentConversionContext<T> conversionContext)
Resolve the given property for the given name.java.util.List<V>
getAll(java.lang.CharSequence name)
Get all the values for the given name without applying conversion.int
hashCode()
java.util.Set<java.lang.String>
names()
java.util.Collection<java.util.List<V>>
values()
protected java.util.Map<java.lang.CharSequence,java.util.List<V>>
wrapValues(java.util.Map<java.lang.CharSequence,java.util.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 io.micronaut.core.value.ValueResolver
get, get, get
-
-
-
-
Field Detail
-
EMPTY
public static final ConvertibleMultiValues EMPTY
-
values
protected final java.util.Map<java.lang.CharSequence,java.util.List<V>> values
-
-
Constructor Detail
-
ConvertibleMultiValuesMap
public ConvertibleMultiValuesMap()
Construct an emptyConvertibleValuesMap
.
-
ConvertibleMultiValuesMap
public ConvertibleMultiValuesMap(java.util.Map<java.lang.CharSequence,java.util.List<V>> values)
Construct aConvertibleValuesMap
from the given map.- Parameters:
values
- The map
-
ConvertibleMultiValuesMap
public ConvertibleMultiValuesMap(java.util.Map<java.lang.CharSequence,java.util.List<V>> values, ConversionService<?> conversionService)
Construct aConvertibleValuesMap
from the given map and conversion service.- Parameters:
values
- The mapconversionService
- The conversion service
-
-
Method Detail
-
get
public <T> java.util.Optional<T> get(java.lang.CharSequence name, ArgumentConversionContext<T> conversionContext)
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
public java.util.List<V> getAll(java.lang.CharSequence name)
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
public V get(java.lang.CharSequence name)
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:
ConvertibleMultiValues.getFirst(CharSequence)
-
names
public java.util.Set<java.lang.String> names()
- Specified by:
names
in interfaceConvertibleValues<V>
- Returns:
- The names of the values
-
values
public java.util.Collection<java.util.List<V>> values()
- Specified by:
values
in interfaceConvertibleValues<V>
- Returns:
- The values
-
wrapValues
protected java.util.Map<java.lang.CharSequence,java.util.List<V>> wrapValues(java.util.Map<java.lang.CharSequence,java.util.List<V>> values)
Wraps the values (by default in an unmodifiable map).- Parameters:
values
- The values- Returns:
- The wrapped values.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-