@SuppressWarnings({"rawtypes","unchecked"}) private static Object asSimpleBinding(Object objToClean){
  if (objToClean instanceof ODocument) {
    logger.trace("Converting embedded ODocument {} to map ",objToClean);
    return DocumentUtil.toMap((ODocument)objToClean,false);
  }
 else   if (objToClean instanceof List) {
    logger.trace("Checking embedded list {} ",objToClean);
    return toSimpleModel((List)objToClean);
  }
 else   if (objToClean instanceof Set) {
    logger.trace("Converting embedded Set {} ",objToClean);
    return toSimpleModel((Set)objToClean);
  }
 else   if (objToClean instanceof Map) {
    logger.trace("Checking embedded map {} ",objToClean);
    return toSimpleModel((Map)objToClean);
  }
 else   if (objToClean instanceof com.orientechnologies.orient.core.id.ORID) {
    logger.warn("Unexpected value of type ORecordId in document. Returning as String.{}",objToClean);
    return objToClean.toString();
  }
 else {
    return objToClean;
  }
}

@ SuppressWarnings ( { "rawtypes" , "unchecked" } ) private static Object asSimpleBinding ( Object objToClean ) { if ( objToClean instanceof ODocument ) { logger . trace ( "Converting embedded ODocument {} to map " , objToClean ) ; return DocumentUtil . toMap ( ( ODocument ) objToClean , false ) ; } else if ( objToClean instanceof List ) { logger . trace ( "Checking embedded list {} " , objToClean ) ; return toSimpleModel ( ( List ) objToClean ) ; } else if ( objToClean instanceof Set ) { logger . trace ( "Converting embedded Set {} " , objToClean ) ; return toSimpleModel ( ( Set ) objToClean ) ; } else if ( objToClean instanceof Map ) { logger . trace ( "Checking embedded map {} " , objToClean ) ; return toSimpleModel ( ( Map ) objToClean ) ; } else if ( objToClean instanceof com . orientechnologies . orient . core . id . ORID ) { logger . warn ( "Unexpected value of type ORecordId in document. Returning as String.{}" , objToClean ) ; return objToClean . toString ( ) ; } else { return objToClean ; } }
recursively ensure that the passed type is represented or converted to json object model simple binding types , i . e . odocument to map , set to list modifies the passed in objtoclean where possible ( list , map ) , returns new types where it is not ( odocument , set )
