src/main/java/org/mongojack/JacksonMongoCollection.java
/**
     * This method provides a static way to convert an object into a Document. Defaults will be used for all parameters
     * left null.
     * 
     * @param object The object to convert
     * @param objectMapper The specific Jackson ObjectMapper to use. (Default MongoJack ObjectMapper)
     * @param view The Jackson View to use in serialization. (Default null)
     * @return
     */
This method provides a static way to convert an object into a Document. Defaults will be used for all parameters
left null.

@param object The object to convert
@param objectMapper The specific Jackson ObjectMapper to use. (Default MongoJack ObjectMapper)
@param view The Jackson View to use in serialization. (Default null)
@return
This method provides a static way to convert an object into a Document . Defaults will be used for all parameters left null . @param object The object to convert @param objectMapper The specific Jackson ObjectMapper to use . ( Default MongoJack ObjectMapper ) @param view The Jackson View to use in serialization . ( Default null ) @return
public static <T> Document convertToDocument(T object, ObjectMapper objectMapper, Class<?> view) {
        if (object == null) {
            return null;
        }
        if (objectMapper == null) {
            objectMapper = DEFAULT_OBJECT_MAPPER;
        }
        DocumentObjectGenerator generator = new DocumentObjectGenerator();
        try {
            objectMapper.writerWithView(view).writeValue(generator, object);
        } catch (JsonMappingException e) {
            throw new MongoJsonMappingException(e);
        } catch (IOException e) {
            throw new MongoException("Unknown error occurred converting BSON to object", e);
        }
        return generator.getDocument();
    }
public static < T > Document convertToDocument ( T object , ObjectMapper objectMapper , Class < ? > view ) { if ( object == null ) { return null ; } if ( objectMapper == null ) { objectMapper = DEFAULT_OBJECT_MAPPER ; } DocumentObjectGenerator generator = new DocumentObjectGenerator ( ) ; try { objectMapper . writerWithView ( view ) . writeValue ( generator , object ) ; } catch ( JsonMappingException e ) { throw new MongoJsonMappingException ( e ) ; } catch ( IOException e ) { throw new MongoException ( "Unknown error occurred converting BSON to object" , e ) ; } return generator . getDocument ( ) ; }
This method provides a static way to convert an object into a Document.
This method provides a static way to convert an object into a Document .
// This shouldn't happen