Class Output


  • public class Output
    extends Object
    The configuration for an output (typically one or more files).
    • Constructor Detail

      • Output

        public Output​(QualifiedName name)
        Constructor.
        Parameters:
        name - the name by which this output can be identified.
    • Method Detail

      • getName

        public QualifiedName getName()
        Returns the name by which this output can be identified.
        Returns:
        the name by which this output can be identified, not null.
      • getSourceProvider

        public SourceProvider getSourceProvider()
        Returns the source provider which provides the input for generating the output file's contents.
        Returns:
        the source provider which provides the input for generation.
      • setSourceProvider

        public void setSourceProvider​(SourceProvider sourceProvider)
        Sets the source provider which provides the input for generating the output file's contents.
        Parameters:
        sourceProvider - the source provider which provides the input for generation.
      • getSourceProcessConfiguration

        public SourceProcessConfiguration getSourceProcessConfiguration()
        Returns how the sources should be post-processed before generation.
        Returns:
        the information about post-processing the sources.
      • setSourceProcessConfiguration

        public void setSourceProcessConfiguration​(SourceProcessConfiguration sourceProcessConfiguration)
        Sets how the sources should be post-processed before generation.
        Parameters:
        sourceProcessConfiguration - the information about post-processing the sources.
      • getPostprocessorDefinitions

        public List<PostprocessorDefinition> getPostprocessorDefinitions()
        Returns the list of postprocessors which should be applied to the generation result.
        Returns:
        the modifiable list of postprocessors, not null. Changes to the returned list change this object as well.
      • setFilename

        public void setFilename​(String filename)
        Sets the name of the file to generate. This is also used to store the generated filename if it was generated using the filenameOutlet.
        Parameters:
        filename - the name of the file to generate.
      • getFilename

        public String getFilename()
        Returns the name of the file to generate. Either this name was given explicitly or it was set using the filenameOutlet.
        Returns:
        the name of the file to generate.
      • getContentOutlet

        public OutletReference getContentOutlet()
        Returns the reference to the outlet which should produce the content.
        Returns:
        the reference to the outlet responsible for producing the content.
      • setContentOutlet

        public void setContentOutlet​(OutletReference contentOutlet)
        Sets the reference to the outlet which should produce the content.
        Parameters:
        contentOutlet - the reference to the outlet responsible for producing the content.
      • getFilenameOutlet

        public Outlet getFilenameOutlet()
        Returns the reference to the outlet which should produce the file name. If this attribute is set, it takes precedence over a set filename.
        Returns:
        the reference to the outlet responsible for producing the file name, or null if the file name is explicitly given.
      • setFilenameOutlet

        public void setFilenameOutlet​(Outlet filenameOutlet)
        Sets the reference to the outlet which should produce the file name.
        Parameters:
        filenameOutlet - the reference to the outlet responsible for producing the file name.
      • getExistingTargetStrategy

        public String getExistingTargetStrategy()
        Returns the strategy how existing target files should be handled.
        Returns:
        the strategy name.
      • setExistingTargetStrategy

        public void setExistingTargetStrategy​(String existingTargetStrategy)
        Sets the strategy how existing target files should be handled.
        Parameters:
        existingTargetStrategy - the strategy name.
      • getOutputDirKey

        public String getOutputDirKey()
        Returns the key for the output directory into which the output is written.
        Returns:
        the key for the output directory, or null for the default output directory.
      • setOutputDirKey

        public void setOutputDirKey​(String outputKeyDir)
        Sets the key for the output directory into which the output is written.
        Parameters:
        outputKeyDir - the key for the output directory, or null for the default output directory.
      • getEncoding

        public String getEncoding()
        Returns the character encoding of the generated file(s).
        Returns:
        The character encoding of the generated file, or null for the platform default encoding.
      • setEncoding

        public void setEncoding​(String encoding)
        Sets the character encoding of the generated file(s).
        Parameters:
        encoding - The character encoding of the generated file, or null for the platform default encoding.
      • setType

        public void setType​(String type)
        Sets the type of the produced output, e.g. java, xml.
        Parameters:
        type - the type, not null.
        Throws:
        NullPointerException - if type is null.
      • getType

        public String getType()
        Returns the type of the produced output, e.g. java, xml.
        Returns:
        the type, not null.
      • getOrDetermineLineBreak

        public String getOrDetermineLineBreak​(String content)
        Returns the line break character(s) for this Output.

        If the line break was already determined, the already determined line break character(s) are returned, and content is ignored.

        If the line break character was not already determined, the occurrence of the different line break characters is counted and the largest is returned ("\r\n" for equal count)

        If one of them is > 0, the result is cached and stored; if all occurrences are 0, the result is not cached and will be determined anew if the method is called another time for the same output.

        Parameters:
        content - the already produced content.
        Returns:
        the line break character(s), one of "\r", "\n", "\r\n".