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 ofConvertibleMultiValuesthat uses a backingLinkedHashMap.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description static ConvertibleMultiValuesEMPTYprotected 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 aConvertibleValuesMapfrom the given map.ConvertibleMultiValuesMap(java.util.Map<java.lang.CharSequence,java.util.List<V>> values, ConversionService<?> conversionService)Construct aConvertibleValuesMapfrom the given map and conversion service.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)Vget(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.inthashCode()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 aConvertibleValuesMapfrom the given map.- Parameters:
values- The map
-
ConvertibleMultiValuesMap
public ConvertibleMultiValuesMap(java.util.Map<java.lang.CharSequence,java.util.List<V>> values, ConversionService<?> conversionService)
Construct aConvertibleValuesMapfrom 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: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
-
getAll
public java.util.List<V> getAll(java.lang.CharSequence name)
Description copied from interface:ConvertibleMultiValuesGet all the values for the given name without applying conversion.- Specified by:
getAllin interfaceConvertibleMultiValues<V>- Parameters:
name- The header name- Returns:
- All the values
-
get
public V get(java.lang.CharSequence name)
Description copied from interface:ConvertibleMultiValuesGet a value without applying any conversion.- Specified by:
getin 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:
namesin interfaceConvertibleValues<V>- Returns:
- The names of the values
-
values
public java.util.Collection<java.util.List<V>> values()
- Specified by:
valuesin 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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-