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 Summary
Constructors Constructor Description AbstractFileHeader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Void
apply(FileContext file, FileHeaderContext context)
Applies the comment file header.protected FileHeaderContext
extractFileHeaderBetweenBlockStartEnd(FileContext file)
Extract file header from the beginning of file between comment block start and end symbol.protected FileHeaderContext
extractFileHeaderWithLinePrefixes(FileContext file)
Extract file header from the beginning of file with all lines starting with line prefix.protected String
getBlockSuffix()
protected String
getCommentBlockEnd()
protected String
getCommentBlockStart()
protected String
getCommentLinePrefix()
protected int
getInsertPosition(String content)
protected String
getLineBreak()
protected String
sanitizeComment(String line)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.wcm.devops.conga.generator.spi.FileHeaderPlugin
extract, implicitApply
-
Methods inherited from interface io.wcm.devops.conga.generator.spi.FilePlugin
accepts
-
-
-
-
Method Detail
-
apply
public final Void apply(FileContext file, FileHeaderContext context)
Description copied from interface:FileHeaderPlugin
Applies the comment file header.- Specified by:
apply
in interfaceFileHeaderPlugin
- Specified by:
apply
in interfaceFilePlugin<FileHeaderContext,Void>
- Parameters:
file
- Context filecontext
- Context objects- Returns:
- nothing
-
getLineBreak
protected String getLineBreak()
-
getCommentBlockStart
protected String getCommentBlockStart()
-
getCommentBlockEnd
protected String getCommentBlockEnd()
-
getCommentLinePrefix
protected String getCommentLinePrefix()
-
getBlockSuffix
protected String getBlockSuffix()
-
getInsertPosition
protected int getInsertPosition(String content)
-
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
-
-