src/main/java/org/mongojack/JacksonMongoCollection.java
/**
     * This method provides a static method to convert a DBObject into a given class. If the ObjectMapper is null, use a
     * default ObjectMapper
     * 
     * @param document
     * @param clazz
     * @param objectMapper
     * @param view
     * @return
     * @throws MongoException
     */
This method provides a static method to convert a DBObject into a given class. If the ObjectMapper is null, use a
default ObjectMapper


This method provides a static method to convert a DBObject into a given class . If the ObjectMapper is null use a default ObjectMapper
public static <S> S convertFromDocument(Document document, Class<S> clazz, ObjectMapper objectMapper, Class<?> view) throws MongoException {
        if (document == null) {
            return null;
        }
        if (objectMapper == null)
            objectMapper = DEFAULT_OBJECT_MAPPER;
        try {
            return objectMapper.readerWithView(view).readValue(new DocumentObjectTraversingParser(document, objectMapper), clazz);
        } catch (JsonMappingException e) {
            throw new MongoJsonMappingException(e);
        } catch (IOException e) {
            throw new MongoException(
                    "Unknown error occurred converting BSON to object", e);
        }
    }
public static < S > S convertFromDocument ( Document document , Class < S > clazz , ObjectMapper objectMapper , Class < ? > view ) throws MongoException { if ( document == null ) { return null ; } if ( objectMapper == null ) objectMapper = DEFAULT_OBJECT_MAPPER ; try { return objectMapper . readerWithView ( view ) . readValue ( new DocumentObjectTraversingParser ( document , objectMapper ) , clazz ) ; } catch ( JsonMappingException e ) { throw new MongoJsonMappingException ( e ) ; } catch ( IOException e ) { throw new MongoException ( "Unknown error occurred converting BSON to object" , e ) ; } }
This method provides a static method to convert a DBObject into a given class.
This method provides a static method to convert a DBObject into a given class .
// This shouldn't happen