code: private boolean isPublicClass(DeclaredType type) {
      Element element = type.asElement();
  
      return element.getModifiers().contains(javax.lang.model.element.Modifier.PUBLIC);
    }
docs: Checks if a class is public