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:
ConvertibleValues<V>
,ValueResolver<java.lang.CharSequence>
,java.lang.Iterable<java.util.Map.Entry<java.lang.String,V>>
- Direct Known Subclasses:
MutableConvertibleValuesMap
public class ConvertibleValuesMap<V> extends java.lang.Object implements ConvertibleValues<V>
An implementation ofConvertibleValues
backed by a map.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<? extends java.lang.CharSequence,V>
map
-
Fields inherited from interface io.micronaut.core.convert.value.ConvertibleValues
EMPTY
-
-
Constructor Summary
Constructors Constructor Description ConvertibleValuesMap()
Constructor.ConvertibleValuesMap(java.util.Map<? extends java.lang.CharSequence,V> map)
Constructor.ConvertibleValuesMap(java.util.Map<? extends java.lang.CharSequence,V> map, ConversionService<?> conversionService)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(java.lang.String name)
Whether the given key is contained within these values.static <V> ConvertibleValues<V>
empty()
An emptyConvertibleValuesMap
.boolean
equals(java.lang.Object o)
<T> java.util.Optional<T>
get(java.lang.CharSequence name, ArgumentConversionContext<T> conversionContext)
Resolve the given property for the given name.V
getValue(java.lang.CharSequence name)
Get a raw value without any conversion.int
hashCode()
java.util.Set<java.lang.String>
names()
java.util.Collection<V>
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, forEach, getValueType, isEmpty, iterator, subMap, subMap, subMap
-
Methods inherited from interface io.micronaut.core.value.ValueResolver
get, get, get
-
-
-
-
Field Detail
-
map
protected final java.util.Map<? extends java.lang.CharSequence,V> map
-
-
Constructor Detail
-
ConvertibleValuesMap
public ConvertibleValuesMap()
Constructor.
-
ConvertibleValuesMap
public ConvertibleValuesMap(java.util.Map<? extends java.lang.CharSequence,V> map)
Constructor.- Parameters:
map
- map of values.
-
ConvertibleValuesMap
public ConvertibleValuesMap(java.util.Map<? extends java.lang.CharSequence,V> map, ConversionService<?> conversionService)
Constructor.- Parameters:
map
- map of values.conversionService
- conversionService
-
-
Method Detail
-
getValue
@Nullable public V getValue(java.lang.CharSequence name)
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
public boolean contains(java.lang.String name)
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
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
-
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<V> values()
- Specified by:
values
in interfaceConvertibleValues<V>
- Returns:
- The values
-
empty
public static <V> ConvertibleValues<V> empty()
An emptyConvertibleValuesMap
.- Type Parameters:
V
- The generic type- Returns:
- The empty
ConvertibleValuesMap
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-