Top Description Inners Fields Constructors Methods
org.springframework.core.convert.support

pack-priv final Class MapToMapConverter

extends Object
implements ConditionalGenericConverter
Class Inheritance
All Implemented Interfaces
org.springframework.core.convert.converter.ConditionalGenericConverter, org.springframework.core.convert.converter.ConditionalConverter, org.springframework.core.convert.converter.GenericConverter
Imports
java.util.ArrayList, .Collections, .List, .Map, .Set, org.springframework.core.CollectionFactory, org.springframework.core.convert.ConversionService, .TypeDescriptor, org.springframework.core.convert.converter.ConditionalGenericConverter, org.springframework.lang.Nullable

Converts a Map to another Map.

First, creates a new Map of the requested targetType with a size equal to the size of the source Map. Then copies each element in the source map to the target map. Will perform a conversion from the source maps's parameterized K,V types to the target map's parameterized types K,V if necessary.

Authors
Keith Donald, Juergen Hoeller
Since
3.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final ConversionService

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private boolean
private boolean
public Object
convert(Object
the source object to convert (may be null)
source
,
TypeDescriptor
the type descriptor of the field we are converting from
sourceType
,
TypeDescriptor
the type descriptor of the field we are converting to
targetType
)

Implements org.springframework.core.convert.converter.GenericConverter.convert.

Convert the source object to the targetType described by the TypeDescriptor.
private Object
convertKey(Object sourceKey, TypeDescriptor sourceType, TypeDescriptor targetType)

private Object
convertValue(Object sourceValue, TypeDescriptor sourceType, TypeDescriptor targetType)

public Set<GenericConverter.ConvertiblePair>
getConvertibleTypes()

Implements org.springframework.core.convert.converter.GenericConverter.getConvertibleTypes.

Return the source and target types that this converter can convert between.
public boolean
matches(TypeDescriptor
the type descriptor of the field we are converting from
sourceType
,
TypeDescriptor
the type descriptor of the field we are converting to
targetType
)

Implements org.springframework.core.convert.converter.ConditionalConverter.matches.

Should the conversion from sourceType to targetType currently under consideration be selected?
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

conversionServiceback to summary
private final ConversionService conversionService

Constructor Detail

MapToMapConverterback to summary
public MapToMapConverter(ConversionService conversionService)

Method Detail

canConvertKeyback to summary
private boolean canConvertKey(TypeDescriptor sourceType, TypeDescriptor targetType)
canConvertValueback to summary
private boolean canConvertValue(TypeDescriptor sourceType, TypeDescriptor targetType)
convertback to summary
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType)

Implements org.springframework.core.convert.converter.GenericConverter.convert.

Doc from org.springframework.core.convert.converter.GenericConverter.convert.

Convert the source object to the targetType described by the TypeDescriptor.

Parameters
source:Object

the source object to convert (may be null)

sourceType:TypeDescriptor

the type descriptor of the field we are converting from

targetType:TypeDescriptor

the type descriptor of the field we are converting to

Returns:Object

the converted object

Annotations
@Override
@Nullable
convertKeyback to summary
private Object convertKey(Object sourceKey, TypeDescriptor sourceType, TypeDescriptor targetType)
Annotations
@Nullable
convertValueback to summary
private Object convertValue(Object sourceValue, TypeDescriptor sourceType, TypeDescriptor targetType)
Annotations
@Nullable
getConvertibleTypesback to summary
public Set<GenericConverter.ConvertiblePair> getConvertibleTypes()

Implements org.springframework.core.convert.converter.GenericConverter.getConvertibleTypes.

Doc from org.springframework.core.convert.converter.GenericConverter.getConvertibleTypes.

Return the source and target types that this converter can convert between.

Each entry is a convertible source-to-target type pair.

For conditional converters this method may return null to indicate all source-to-target pairs should be considered.

Annotations
@Override
matchesback to summary
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType)

Implements org.springframework.core.convert.converter.ConditionalConverter.matches.

Doc from org.springframework.core.convert.converter.ConditionalConverter.matches.

Should the conversion from sourceType to targetType currently under consideration be selected?

Parameters
sourceType:TypeDescriptor

the type descriptor of the field we are converting from

targetType:TypeDescriptor

the type descriptor of the field we are converting to

Returns:boolean

true if conversion should be performed, false otherwise

Annotations
@Override
org.springframework.core.convert.support back to summary

private Class MapToMapConverter.MapEntry

extends Object
Class Inheritance
  • java.lang.Object
  • org.springframework.core.convert.support.MapToMapConverter.MapEntry

Field Summary

Modifier and TypeField and Description
private final Object
private final Object

Constructor Summary

AccessConstructor and Description
public
MapEntry(Object key, Object value)

Method Summary

Modifier and TypeMethod and Description
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

keyback to summary
private final Object key
Annotations
@Nullable
valueback to summary
private final Object value
Annotations
@Nullable

Constructor Detail

MapEntryback to summary
public MapEntry(Object key, Object value)

Method Detail

addToMapback to summary
public void addToMap(Map<Object, Object> map)