Class AbstractFileHeader

java.lang.Object
io.wcm.devops.conga.generator.plugins.fileheader.AbstractFileHeader
All Implemented Interfaces:
FileHeaderPlugin, FilePlugin<FileHeaderContext,Void>, Plugin
Direct Known Subclasses:
ConfFileHeader, JsonFileHeader, UnixShellScriptFileHeader, WindowsShellScriptFileHeader

public abstract class AbstractFileHeader extends Object implements FileHeaderPlugin
Generic file header plugin implementation.
  • Constructor Details

    • AbstractFileHeader

      public AbstractFileHeader()
  • Method Details

    • apply

      public final Void apply(FileContext file, FileHeaderContext context)
      Description copied from interface: FileHeaderPlugin
      Applies the comment file header.
      Specified by:
      apply in interface FileHeaderPlugin
      Specified by:
      apply in interface FilePlugin<FileHeaderContext,Void>
      Parameters:
      file - Context file
      context - Context objects
      Returns:
      nothing
    • sanitizeComment

      protected String sanitizeComment(String line)
      Sanitizes comment line.
      Parameters:
      line - Comment line
      Returns:
      Sanitized comment line
    • getLineBreak

      protected String getLineBreak()
      Gets line break character(s).
      Returns:
      Line break character(s)
    • getCommentBlockStart

      protected String getCommentBlockStart()
      Gets comment block start.
      Returns:
      Comment block start string
    • getCommentBlockEnd

      protected String getCommentBlockEnd()
      Gets comment block end.
      Returns:
      Comment block end string
    • getCommentLinePrefix

      protected String getCommentLinePrefix()
      Gets comment line prefix.
      Returns:
      Comment line prefix string
    • getBlockSuffix

      protected String getBlockSuffix()
      Gets block suffix.
      Returns:
      Block suffix string
    • getInsertPosition

      protected int getInsertPosition(String content)
      Gets insert position for file header.
      Parameters:
      content - File content
      Returns:
      Insert position
    • extractFileHeaderBetweenBlockStartEnd

      protected final FileHeaderContext extractFileHeaderBetweenBlockStartEnd(FileContext file)
      Extract file header from the beginning of file between comment block start and end symbol.
      Parameters:
      file - File
      Returns:
      File header or null
    • extractFileHeaderWithLinePrefixes

      protected final FileHeaderContext extractFileHeaderWithLinePrefixes(FileContext file)
      Extract file header from the beginning of file with all lines starting with line prefix.
      Parameters:
      file - File File
      Returns:
      File header or null