code: public static TypeVisibility getVisibility(TypeRepository typeRepository, String typeName) {
          try {
              Class<?> type = typeRepository.loadClass(typeName);
              int modifiers = type.getModifiers();
              if (Modifier.isPrivate(modifiers)) {
                  return TypeVisibility.PRIVATE;
              } else if (Modifier.isPublic(modifiers)) {
                  return TypeVisibility.PUBLIC;
              } else if (Modifier.isProtected(modifiers)) {
                  return TypeVisibility.PROTECTED;
              } else {
                  return TypeVisibility.PACKAGE;
              }
          } catch (ClassNotFoundException e) {
              log.warn("Visibility for type " + typeName + " could not be found.");
              return null;
          }
      }
docs: Finds the visibility of a given type.
  
  @param typeRepository the repository where types should be loaded from
  @param typeName       the fully qualified type name
  @return               a TypeVisibility object representing the visibility (e.g. public, package, etc)