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

com.lordofthejars.nosqlunit.demo.mongodb.MongoDbBookConverter Maven / Gradle / Ivy

There is a newer version: 1.0.0-rc.5
Show newest version
package com.lordofthejars.nosqlunit.demo.mongodb;

import ch.lambdaj.function.convert.Converter;

import com.lordofthejars.nosqlunit.demo.model.Book;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;

public class MongoDbBookConverter implements Converter {

	public static final String TITLE_FIELD = "title";
	public static final String NUM_PAGES_FIELD = "numberOfPages";

	@Override
	public DBObject convert(Book book) {
		
		DBObject dbObject = new BasicDBObject();
		
		dbObject.put(TITLE_FIELD, book.getTitle());
		dbObject.put(NUM_PAGES_FIELD, book.getNumberOfPages());
		
		return dbObject;
	}

	

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy