All Downloads are FREE. Search and download functionalities are using the official Maven repository.

br.com.anteros.nosql.persistence.mongodb.mapping.MongoValueMapper Maven / Gradle / Ivy

There is a newer version: 1.0.6
Show newest version
package br.com.anteros.nosql.persistence.mongodb.mapping;


import java.util.Map;

import br.com.anteros.nosql.persistence.metadata.NoSQLDescriptionField;
import br.com.anteros.nosql.persistence.session.NoSQLSession;
import br.com.anteros.nosql.persistence.session.cache.NoSQLEntityCache;
import br.com.anteros.nosql.persistence.session.mapping.AbstractNoSQLObjectMapper;
import br.com.anteros.nosql.persistence.session.mapping.NoSQLCustomMapper;


class MongoValueMapper implements NoSQLCustomMapper {
	
    @Override
    public void fromDocument(final NoSQLSession session, final Object dbObject, final NoSQLDescriptionField descriptionField, final Object entity,
                             final NoSQLEntityCache cache, final AbstractNoSQLObjectMapper mapper) {
        mapper.getConverters().fromDocument(dbObject, descriptionField, entity);
    }

    @Override
    public void toDocument(final Object entity, final NoSQLDescriptionField descriptionField, final Object dbObject, final Map involvedObjects,
                           final AbstractNoSQLObjectMapper mapper) {
        try {
            mapper.getConverters().toDocument(entity, descriptionField, dbObject, mapper.getOptions());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy