Class WebComponentModulesWriter.DirectoryWriter

java.lang.Object
com.vaadin.flow.server.webcomponent.WebComponentModulesWriter.DirectoryWriter
All Implemented Interfaces:
Serializable
Enclosing class:
WebComponentModulesWriter

public static final class WebComponentModulesWriter.DirectoryWriter extends Object implements Serializable
Enables the usage of given WebComponentModulesWriter class via reflection. This is to simplify the usage of the WebComponentModulesWriter when the writer and received WebComponentExporter classes are loaded by a different class loader than the code using the writer.
See Also:
  • Constructor Details

    • DirectoryWriter

      public DirectoryWriter()
  • Method Details

    • generateWebComponentsToDirectory

      public static Set<File> generateWebComponentsToDirectory(Class<?> writerClass, Set<Class<?>> exporterClasses, File outputDirectory, String themeName)
      Calls WebComponentModulesWriter.writeWebComponentsToDirectory(java.util.Set, java.io.File, java.lang.String) via reflection on the supplied writer. The writer and exporterClasses must be loaded with the same class loader.
      Parameters:
      writerClass - WebComponentModulesWriter class
      exporterClasses - set of WebComponentExporter/WebComponentExporterFactory classes, loaded with the same class loader as writer
      outputDirectory - target directory for the generated web component module files
      themeName - the theme defined using Theme or null if not defined
      Returns:
      generated files
      Throws:
      NullPointerException - if writerClassSupplier, exporterClassSupplier, or outputDirectory is null
      IllegalArgumentException - if writer is not WebComponentModulesWriter class
      IllegalArgumentException - if writerClass and exporterClasses do not share a class loader
      IllegalStateException - if the received writer does not have method WebComponentModulesWriter.writeWebComponentsToDirectory(java.util.Set, java.io.File, java.lang.String)
      RuntimeException - if reflective method invocation fails
      See Also:
      • WebComponentModulesWriter.writeWebComponentsToDirectory(java.util.Set, java.io.File, java.lang.String)