Spring Data Document

org.springframework.data.mongodb.core.convert
Interface MongoWriter<T>

Type Parameters:
T - the type of the object to convert to a DBObject
All Superinterfaces:
org.springframework.data.convert.EntityWriter<T,DBObject>
All Known Subinterfaces:
MongoConverter
All Known Implementing Classes:
AbstractMongoConverter, MappingMongoConverter

public interface MongoWriter<T>
extends org.springframework.data.convert.EntityWriter<T,DBObject>

A MongoWriter is responsible for converting an object of type T to the native MongoDB representation DBObject.

Author:
Mark Pollack, Thomas Risberg, Oliver Gierke

Method Summary
 Object convertToMongoType(Object obj)
          Converts the given object into one Mongo will be able to store natively.
 DBRef toDBRef(Object object, MongoPersistentProperty referingProperty)
          Creates a DBRef to refer to the given object.
 
Methods inherited from interface org.springframework.data.convert.EntityWriter
write
 

Method Detail

convertToMongoType

Object convertToMongoType(Object obj)
Converts the given object into one Mongo will be able to store natively. If the given object can already be stored as is, no conversion will happen.

Parameters:
obj -
Returns:

toDBRef

DBRef toDBRef(Object object,
              MongoPersistentProperty referingProperty)
Creates a DBRef to refer to the given object.

Parameters:
object - the object to create a DBRef to link to. The object's type has to carry an id attribute.
referingProperty - the client-side property referring to the object which might carry additional metadata for the DBRef object to create. Can be null.
Returns:
will never be null.

Spring Data Document

Copyright © 2012. All Rights Reserved.