Package org.mongodb.morphia.mapping.lazy

Source Code of org.mongodb.morphia.mapping.lazy.DefaultDatastoreProvider

package org.mongodb.morphia.mapping.lazy;


import org.mongodb.morphia.Datastore;


/**
* Default implementation to be used in the assumption 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 org.mongodb.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.