Package com.github.jmkgreen.morphia.mapping.lazy

Source Code of com.github.jmkgreen.morphia.mapping.lazy.DefaultDatastoreProvider

package com.github.jmkgreen.morphia.mapping.lazy;

import com.github.jmkgreen.morphia.Datastore;

/**
* Default implementation to be used in the assumtion that one Datastore per
* classloader is the default wa to use Morphia. Might be discussable.
*
* @author uwe schaefer
*/
public class DefaultDatastoreProvider implements DatastoreProvider {
    /**
     *
     */
    private static final long serialVersionUID = 1L;

    public Datastore get() {
        final Datastore datastore = DatastoreHolder.getInstance().get();
        if (datastore == null) {
            throw new IllegalStateException(
                    "DatastoreHolder does not carry a Datastore.");
        }
        return datastore;
    }

}
TOP

Related Classes of com.github.jmkgreen.morphia.mapping.lazy.DefaultDatastoreProvider

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.