code: public static <T extends AbstractTextExtractor, TP extends AbstractTextExtractor.AbstractParameters> T newInstance(TP parameters) {
          try {
              //By convention the Parameters are enclosed in the Extactor.
              Class<T> tClass = (Class<T>) parameters.getClass().getEnclosingClass();
              return tClass.getConstructor(parameters.getClass()).newInstance(parameters);
          } 
          catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | SecurityException | NoSuchMethodException ex) {
              throw new RuntimeException(ex);
          }
      }
docs: Generates a new instance of a AbstractTextExtractor by providing the Class of the
  AbstractTextExtractor.
  
  @param <T>
  @param <TP>
  @param parameters
  @return