Class FileGenerator<C>

  • Type Parameters:
    C - The type of components to assemble

    public class FileGenerator<C>
    extends Generator<C>
    Generate a file by assembling components.
    • Constructor Detail

      • FileGenerator

        public FileGenerator​(Assembler<C> assembler)
        Assemble a file using the given assembler into a temporary directory.
        Parameters:
        assembler - The assembler to build up the file
      • FileGenerator

        public FileGenerator​(Assembler<C> assembler,
                             java.io.File dir)
        Assemble a file using the given assembler into the given directory.
        Parameters:
        assembler - The assembler to build up the file
        dir - The directory in which to generate the file
      • FileGenerator

        public FileGenerator​(Assembler<C> assembler,
                             java.util.function.Supplier<java.io.File> fileSupplier)
        Assemble a file using the given assembler into the given directory.
        Parameters:
        assembler - The assembler to build up the file
        fileSupplier - A function that supplies the file to write to
    • Method Detail

      • generate

        public FileGenerationMetrics generate​(java.lang.Iterable<C> components)
                                       throws java.io.IOException
        Generate a file by assembling components.
        Parameters:
        components - The components to assemble
        Returns:
        The generated file and metrics about the generation process
        Throws:
        java.io.IOException - When an I/O error occurs
      • generate

        public FileGenerationMetrics generate​(java.util.Iterator<C> components)
                                       throws java.io.IOException
        Generate a file by assembling components.
        Parameters:
        components - The components to assemble
        Returns:
        The generated file and metrics about the generation process
        Throws:
        java.io.IOException - When an I/O error occurs
      • generate

        public FileGenerationMetrics generate​(java.util.Enumeration<C> components)
                                       throws java.io.IOException
        Generate a file by assembling components.
        Parameters:
        components - The components to assemble
        Returns:
        The generated file and metrics about the generation process
        Throws:
        java.io.IOException - When an I/O error occurs
      • generate

        public FileGenerationMetrics generate​(C component)
                                       throws java.io.IOException
        Generate a file from a single component.
        Parameters:
        component - The component to generate the file from
        Returns:
        The generated file and metrics about the generation process
        Throws:
        java.io.IOException - When an I/O error occurs