Example usage for org.springframework.data.util ClassTypeInformation LIST

List of usage examples for org.springframework.data.util ClassTypeInformation LIST

Introduction

In this page you can find the example usage for org.springframework.data.util ClassTypeInformation LIST.

Prototype

ClassTypeInformation LIST

To view the source code for org.springframework.data.util ClassTypeInformation LIST.

Click Source Link

Usage

From source file:org.springframework.data.mongodb.core.convert.MappingMongoConverter.java

/**
 * Internal write conversion method which should be used for nested invocations.
 * /* www.  j av a  2 s. c o  m*/
 * @param obj
 * @param dbo
 */
@SuppressWarnings("unchecked")
protected void writeInternal(final Object obj, final DBObject dbo, final TypeInformation<?> typeHint) {

    if (null == obj) {
        return;
    }

    Class<?> customTarget = conversions.getCustomWriteTarget(obj.getClass(), DBObject.class);

    if (customTarget != null) {
        DBObject result = conversionService.convert(obj, DBObject.class);
        dbo.putAll(result);
        return;
    }

    if (Map.class.isAssignableFrom(obj.getClass())) {
        writeMapInternal((Map<Object, Object>) obj, dbo, ClassTypeInformation.MAP);
        return;
    }

    if (Collection.class.isAssignableFrom(obj.getClass())) {
        writeCollectionInternal((Collection<?>) obj, ClassTypeInformation.LIST, (BasicDBList) dbo);
        return;
    }

    MongoPersistentEntity<?> entity = mappingContext.getPersistentEntity(obj.getClass());
    writeInternal(obj, dbo, entity);
    addCustomTypeKeyIfNecessary(typeHint, obj, dbo);
}