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 ofConvertibleValuesbacked 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 booleancontains(java.lang.String name)Whether the given key is contained within these values.static <V> ConvertibleValues<V>empty()An emptyConvertibleValuesMap.<T> java.util.Optional<T>get(java.lang.CharSequence name, ArgumentConversionContext<T> conversionContext)Resolve the given property for the given name.VgetValue(java.lang.CharSequence name)Get a raw value without any conversion.java.util.Set<java.lang.String>names()java.util.Collection<V>values()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, 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:ConvertibleValuesGet a raw value without any conversion.- Specified by:
getValuein interfaceConvertibleValues<V>- Parameters:
name- The key name- Returns:
- True if it is
-
contains
public boolean contains(java.lang.String name)
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
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
-
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<V> values()
- Specified by:
valuesin interfaceConvertibleValues<V>- Returns:
- The values
-
empty
public static <V> ConvertibleValues<V> empty()
An emptyConvertibleValuesMap.- Type Parameters:
V- The generic type- Returns:
- The empty
ConvertibleValuesMap
-
-