code: @SuppressWarnings("unchecked")
    public static <T> Class<T> forOptionalName(String className)
    {
      if(className == null) {
        return null;
      }
      ClassLoader loader = Thread.currentThread().getContextClassLoader();
      if(loader != null) {
        try {
          return (Class<T>)Class.forName(className, true, loader);
        }
        catch(ClassNotFoundException expected) {}
      }
  
      // try this utility class class loader only if not set as current thread context class loader
  
      if(loader == null || !loader.equals(Classes.class.getClassLoader())) {
        try {
          return (Class<T>)Class.forName(className, true, Classes.class.getClassLoader());
        }
        catch(ClassNotFoundException unused) {}
      }
  
      return null;
    }
docs: Get optional class by name or null if class not found. Tries to load the class with given class name returning null
  if not found. This method does not throw exceptions nor log missing class exception. It is supposed caller will
  test for null returned value and take appropriate action.
  <p>
  Uses current thread context class loader to locate and load requested class. If current thread context class loader
  is null or fails to find requested class try with this utility class class loader.
  <p>
  This logic is designed for Tomcat class loading algorithm. Libraries are loaded using a separated class loader and
  every application has its own class loader. This method algorithm allows for a class used by an application to be
  found either by current thread or by library class loader.
  <p>
  Considering above, note that there is a subtle difference compared with standard {@link Class#forName(String)}
  counterpart: this method uses <code>current thread context loader</code> whereas Java standard uses
  <code>current loader</code>. Maybe not obvious, this 'semantic' difference could lead to class not found on Java
  standard while this utility method find the class. For example, a class defined by an web application could not be
  found by Java <code>Class.forName</code> method running inside a class defined by library.
  
  @param className requested class name, null tolerated.
  @param <T> class to auto-cast named class.
  @return class identified by name or null if not found or given class name argument is null.
  @throws ClassCastException if found class cannot cast to requested auto-cast type.