code: public static StorageResourceId convertToDirectoryPath(StorageResourceId resourceId) {
      if (resourceId.isStorageObject()) {
        if (!objectHasDirectoryPath(resourceId.getObjectName())) {
          resourceId = new StorageResourceId(
              resourceId.getBucketName(), convertToDirectoryPath(resourceId.getObjectName()));
        }
      }
      return resourceId;
    }
docs: Converts the given resourceId to look like a directory path.
  If the path already looks like a directory path then
  this call is a no-op.
  
  @param resourceId StorageResourceId to convert.
  @return A resourceId with a directory path corresponding to the given resourceId.