public Object toObjectDetermineType(OResult source, OCommandContext ctx){
    String className = getClassNameForDocument(ctx);
    String type = getTypeForDocument(ctx);
    if (className != null || (type != null && "d".equalsIgnoreCase(type))) {
      return toDocument(source, ctx, className);
    }
    else{
      return toMap(source, ctx);
    }
  }
public Object toObjectDetermineType(OResult source, OCommandContext ctx){
    String className = getClassNameForDocument(ctx);
    String type = getTypeForDocument(ctx);
    if (className != null || (type != null && "d".equalsIgnoreCase(type))) {
      return toDocument(source, ctx, className);
    }
    else{
      return toMap(source, ctx);
    }
  }
public Object toObjectDetermineType ( OResult source , OCommandContext ctx ) { String className = getClassNameForDocument ( ctx ) ; String type = getTypeForDocument ( ctx ) ; if ( className != null || ( type != null && "d" . equalsIgnoreCase ( type ) ) ) { return toDocument ( source , ctx , className ) ; } else { return toMap ( source , ctx ) ; } }
choosing return type is based on existence of @class and @type field in JSON
@param source
@param ctx
@return
choosing return type is based on existence of