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

com.elepy.mongo.MongoCrudFactory Maven / Gradle / Ivy

package com.elepy.mongo;

import com.elepy.annotations.Inject;
import com.elepy.dao.Crud;
import com.elepy.dao.CrudFactory;
import com.elepy.models.Schema;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mongodb.client.MongoDatabase;

public class MongoCrudFactory implements CrudFactory {

    @Inject
    private MongoDatabase database;

    @Inject
    private ObjectMapper objectMapper;


    @Override
    public  Crud crudFor(Schema schema) {

        final String path = schema.getPath();
        final String[] split = path.split("/");


        return new MongoDao<>(database, split[split.length - 1], schema);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy