public class Morphia extends Object
Constructor and Description |
---|
Morphia() |
Morphia(Mapper mapper) |
Morphia(Mapper mapper,
Set<Class> classesToMap) |
Morphia(Set<Class> classesToMap) |
Modifier and Type | Method and Description |
---|---|
Datastore |
createDatastore(com.mongodb.MongoClient mongoClient,
Mapper mapper,
String dbName)
Creates a new Datastore for interacting with MongoDB using POJOs
|
Datastore |
createDatastore(com.mongodb.MongoClient mongoClient,
String dbName)
It is best to use a Mongo singleton instance here.
|
<T> T |
fromDBObject(Class<T> entityClass,
com.mongodb.DBObject dbObject) |
<T> T |
fromDBObject(Class<T> entityClass,
com.mongodb.DBObject dbObject,
EntityCache cache) |
Mapper |
getMapper() |
boolean |
getUseBulkWriteOperations() |
boolean |
isMapped(Class entityClass)
Check whether a specific class is mapped by this instance.
|
boolean |
isUseBulkWriteOperations() |
Morphia |
map(Class... entityClasses) |
Morphia |
map(Set<Class> entityClasses) |
Morphia |
mapPackage(String packageName)
Tries to map all classes in the package specified.
|
Morphia |
mapPackage(String packageName,
boolean ignoreInvalidClasses)
Tries to map all classes in the package specified.
|
Morphia |
mapPackageFromClass(Class clazz) |
void |
setUseBulkWriteOperations(boolean useBulkWriteOperations) |
com.mongodb.DBObject |
toDBObject(Object entity) |
public Morphia()
public Morphia(Mapper mapper)
public Morphia mapPackage(String packageName)
packageName
- the name of the package to processpublic Morphia mapPackage(String packageName, boolean ignoreInvalidClasses)
packageName
- the name of the package to processignoreInvalidClasses
- specifies whether to ignore classes in the package that cannot be mappedpublic boolean isMapped(Class entityClass)
entityClass
- the class we want to checkpublic <T> T fromDBObject(Class<T> entityClass, com.mongodb.DBObject dbObject)
public <T> T fromDBObject(Class<T> entityClass, com.mongodb.DBObject dbObject, EntityCache cache)
public com.mongodb.DBObject toDBObject(Object entity)
public Mapper getMapper()
public Datastore createDatastore(com.mongodb.MongoClient mongoClient, String dbName)
mongoClient
- the representations of the connection to a MongoDB instancedbName
- the name of the databasepublic Datastore createDatastore(com.mongodb.MongoClient mongoClient, Mapper mapper, String dbName)
mongoClient
- the representations of the connection to a MongoDB instancemapper
- a pre-configured Mapper for your POJOsdbName
- the name of the databasepublic boolean getUseBulkWriteOperations()
public boolean isUseBulkWriteOperations()
public void setUseBulkWriteOperations(boolean useBulkWriteOperations)
Copyright © 2016. All rights reserved.