public class DefaultDbRefResolver extends Object implements DbRefResolver
DbRefResolver that resolves DBRefs by delegating to a
DbRefResolverCallback than is able to generate lazy loading proxies.| Constructor and Description |
|---|
DefaultDbRefResolver(MongoDbFactory mongoDbFactory)
Creates a new
DefaultDbRefResolver with the given MongoDbFactory. |
| Modifier and Type | Method and Description |
|---|---|
List<org.bson.Document> |
bulkFetch(List<com.mongodb.DBRef> refs)
Loads a given
List of DBRefs from the datasource in one batch. |
org.bson.Document |
fetch(com.mongodb.DBRef dbRef)
Actually loads the
DBRef from the datasource. |
protected com.mongodb.client.MongoCollection<org.bson.Document> |
getCollection(com.mongodb.DBRef dbref)
Customization hook for obtaining the
MongoCollection for a given DBRef. |
Object |
resolveDbRef(MongoPersistentProperty property,
com.mongodb.DBRef dbref,
DbRefResolverCallback callback,
DbRefProxyHandler handler)
Resolves the given
DBRef into an object of the given MongoPersistentProperty's type. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateDbRefpublic DefaultDbRefResolver(MongoDbFactory mongoDbFactory)
DefaultDbRefResolver with the given MongoDbFactory.mongoDbFactory - must not be null.public Object resolveDbRef(MongoPersistentProperty property, @Nullable com.mongodb.DBRef dbref, DbRefResolverCallback callback, DbRefProxyHandler handler)
DbRefResolverDBRef into an object of the given MongoPersistentProperty's type. The method
might return a proxy object for the DBRef or resolve it immediately. In both cases the
DbRefResolverCallback will be used to obtain the actual backing object.resolveDbRef in interface DbRefResolverproperty - will never be null.dbref - the DBRef to resolve.callback - will never be null.public org.bson.Document fetch(com.mongodb.DBRef dbRef)
DbRefResolverDBRef from the datasource.fetch in interface DbRefResolverdbRef - must not be null.public List<org.bson.Document> bulkFetch(List<com.mongodb.DBRef> refs)
DbRefResolverList of DBRefs from the datasource in one batch. The resulting List of
Document will reflect the ordering of the DBRef passed in.DBRef elements in the list must not reference different collections.bulkFetch in interface DbRefResolverrefs - must not be null.protected com.mongodb.client.MongoCollection<org.bson.Document> getCollection(com.mongodb.DBRef dbref)
MongoCollection for a given DBRef.dbref - must not be null.MongoCollection the given DBRef points to.Copyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.