code: public static Object applyProjection(final Object object, final Class<?> returnClass) {
          Object res = object;
          if (!ODocument.class.isAssignableFrom(returnClass)) {
              ODocument doc = null;
              if (object instanceof ODocument) {
                  doc = (ODocument) object;
              }
              if (object instanceof OIdentifiable) {
                  // most likely OrientVertex, which is returned under graph connection, even for partial requests
                  final Object record = ((OIdentifiable) object).getRecord();
                  if (record instanceof ODocument) {
                      doc = (ODocument) record;
                  }
              }
              if (doc != null && doc.fieldNames().length == 1) {
                  res = doc.fieldValues()[0];
                  // if required, perform result correction
                  if (res != null && !returnClass.isAssignableFrom(res.getClass())) {
                      res = convertPlainImpl(res, returnClass, true);
                  }
              }
          }
          return res;
      }
docs: Flattening is important for simple cases: when querying for count (or other aggregated function) or
  for single field (column).
  
  @param object      result object
  @param returnClass expected type
  @return either object itself or just object field (extracted)