Replaced custom implementation over usage of TypeInformation.getActualType().

This commit is contained in:
Oliver Gierke
2011-06-17 20:28:13 +02:00
parent 2e86012b3f
commit c1b396cca5

View File

@@ -585,7 +585,7 @@ public class MappingMongoConverter extends AbstractMongoConverter implements App
return;
}
Class<?> reference = getValueType(type).getType();
Class<?> reference = type.getActualType().getType();
boolean notTheSameClass = !value.getClass().equals(reference);
if (notTheSameClass) {
@@ -593,24 +593,6 @@ public class MappingMongoConverter extends AbstractMongoConverter implements App
}
}
/**
* Returns the type type information of the actual value to be stored. That is, for maps it will return the map value
* type, for collections it will return the component type as well as the given type if it is a non-collection or
* non-map one.
*
* @param type
* @return
*/
public TypeInformation<?> getValueType(TypeInformation<?> type) {
if (type.isMap()) {
return type.getMapValueType();
} else if (type.isCollectionLike()) {
return type.getComponentType();
} else {
return type;
}
}
/**
* Writes the given simple value to the given {@link DBObject}. Will store enum names for enum values.
*