docs: public static boolean is(@Nullable Resource resource, @Nullable String resourceType) {
      if (resource == null || resourceType == null) {
        return false;
      }
      ResourceResolver resolver = resource.getResourceResolver();
      // Check if the resource is of the given type. This method first checks the
      // resource type of the resource, then its super resource type and continues
      //  to go up the resource super type hierarchy.
      boolean result = false;
      if (ResourceType.equals(resourceType, resource.getResourceType())) {
        result = true;
      }
      else {
        Set<String> superTypesChecked = new HashSet<>();
        String superType = resolver.getParentResourceType(resource);
        while (!result && superType != null) {
          if (ResourceType.equals(resourceType, superType)) {
            result = true;
          }
          else {
            superTypesChecked.add(superType);
            superType = resolver.getParentResourceType(superType);
            if (superType != null && superTypesChecked.contains(superType)) {
              throw new SlingException("Cyclic dependency for resourceSuperType hierarchy detected on resource " + resource.getPath(), null);
            }
          }
        }
      }
      return result;
    }