static public JSONObject recreateDocumentFromDocAndReserved ( JSONObject doc , JSONObject reserved ) throws Exception { JSONObject result = JSONSupport . copyObject ( doc ) ; // Re-insert attributes that start with '_' if ( null != reserved ) { Iterator < ? > it = reserved . keys ( ) ; while ( it . hasNext ( ) ) { Object keyObj = it . next ( ) ; if ( keyObj instanceof String ) { String key = ( String ) keyObj ; Object value = reserved . opt ( key ) ; result . put ( "_" + key , value ) ; } } } return result ; }
Re - creates a document given the document and the reserved keys .