public void parse ( UNode rootNode ) { assert rootNode != null ; // Ensure root node is named "batch". Utils . require ( rootNode . getName ( ) . equals ( "batch" ) , "'batch' expected: " + rootNode . getName ( ) ) ; // Parse child nodes. for ( String memberName : rootNode . getMemberNames ( ) ) { UNode childNode = rootNode . getMember ( memberName ) ; if ( childNode . getName ( ) . equals ( "docs" ) ) { Utils . require ( childNode . isCollection ( ) , "'docs' must be a collection: " + childNode ) ; for ( UNode docNode : childNode . getMemberList ( ) ) { Utils . require ( docNode . getName ( ) . equals ( "doc" ) , "'doc' node expected as child of 'docs': " + docNode ) ; addObject ( new DBObject ( ) ) . parse ( docNode ) ; } } else { Utils . require ( false , "Unrecognized child node of 'batch': " + memberName ) ; } } }
Parse a batch object update rooted at the given UNode . The root node must be a MAP named batch . Child nodes must be a recognized option or a docs array containing doc objects . An exception is thrown if the batch is malformed .