Class AbstractFileHeaderTransformer
java.lang.Object
org.codehaus.mojo.license.header.transformer.AbstractFileHeaderTransformer
- All Implemented Interfaces:
FileHeaderTransformer
- Direct Known Subclasses:
AptFileHeaderTransformer,FreeMarkerFileHeaderTransformer,HtmlFileHeaderTransformer,JavaFileHeaderTransformer,JspFileHeaderTransformer,MySqlFileHeaderTransformer,PhpFileHeaderTransformer,PropertiesFileHeaderTransformer,RstFileHeaderTransformer,SqlFileHeaderTransformer,XmlFileHeaderTransformer
Abstract implementation of
FileHeaderTransformer.
Concrete implementation should only have to give comment configuration.- Since:
- 1.0
- Author:
- tchemit dev@tchemit.fr
-
Field Summary
Fields inherited from interface org.codehaus.mojo.license.header.transformer.FileHeaderTransformer
DEFAULT_PROCESS_END_TAG, DEFAULT_PROCESS_START_TAG, DEFAULT_SECTION_DELIMITER, LINE_SEPARATOR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds the header.boxComment(String header, boolean withTags) Box the givenheaderin a comment.boxProcessTag(String header) Box the givenheaderbetween process tags.getName()Obtain the process tag which indiciates the end of the header content.Obtains the process tag which indicates the begin of the header content.The pattern used to separate sections of the header.booleanisCopyrightEquals(FileHeader header1, FileHeader header2) Tests if the copyright of the two models are equals.booleanisDescriptionEquals(FileHeader header1, FileHeader header2) Tests if the description of the two models are equals.booleanGet flag if there should be an empty line after the header.booleanisLicenseEquals(FileHeader header1, FileHeader header2) Tests if the license of the two models are equals.booleanGet flag if header line should be right trimmed when written.voidsetCommentEndTag(String commentEndTag) Changes the comment end tag.voidsetCommentLinePrefix(String commentLinePrefix) Changes the comment prefix line.voidsetCommentStartTag(String commentStartTag) Changes the comment start tag.voidsetDescription(String description) Chages the description of the transformer.voidsetEmptyLineAfterHeader(boolean emptyLine) Set flag if there should be an empty line after the header.voidsetLineSeparator(String lineSeparator) voidChanges the name of the transformer.voidsetProcessEndTag(String processEndTag) Changes the process end tag.voidsetProcessStartTag(String processStartTag) Changes the process start tag.voidsetSectionDelimiter(String sectionDelimiter) Sets the header section delimiter.voidsetTrimHeaderLine(boolean trimLine) Set flag if header line should be right trimmed when written.toFileHeader(String header) Build aFileHeaderfrom an UNBOXED header content.toHeaderContent(FileHeader model) Build a fully boxed header content from the givenmodel.toString(FileHeader model) Build a UNBOXED header content from the givenmodel.unboxComent(String header) Unbox the given boxedboxedHeaderto obtain the header content.unboxProcessTag(String boxedHeader) Unbox the process tag on the given boxedboxedHeaderto obtain the brute header content.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.codehaus.mojo.license.header.transformer.FileHeaderTransformer
getDefaultAcceptedExtensions
-
Constructor Details
-
AbstractFileHeaderTransformer
-
-
Method Details
-
getName
- Specified by:
getNamein interfaceFileHeaderTransformer- Returns:
- the name of the transformer
-
setName
Changes the name of the transformer.- Specified by:
setNamein interfaceFileHeaderTransformer- Parameters:
name- the new name of the transformer
-
getDescription
- Specified by:
getDescriptionin interfaceFileHeaderTransformer- Returns:
- the description of the transformer
-
setDescription
Chages the description of the transformer.- Specified by:
setDescriptionin interfaceFileHeaderTransformer- Parameters:
description- the new description of the transformer
-
getSectionDelimiter
The pattern used to separate sections of the header. By default, (says if you do not explicitly invoke theFileHeaderTransformer.setSectionDelimiter(String)method), will use theFileHeaderTransformer.DEFAULT_SECTION_DELIMITER.- Specified by:
getSectionDelimiterin interfaceFileHeaderTransformer- Returns:
- the delimiter used to separate sections in the header.
-
setSectionDelimiter
Sets the header section delimiter. By default, will use theFileHeaderTransformer.DEFAULT_SECTION_DELIMITER.- Specified by:
setSectionDelimiterin interfaceFileHeaderTransformer- Parameters:
sectionDelimiter- the new delimiter
-
getProcessStartTag
Obtains the process tag which indicates the begin of the header content. By default, (says if you do not explicitly invoke theFileHeaderTransformer.setProcessStartTag(String)method), will use theFileHeaderTransformer.DEFAULT_PROCESS_START_TAG- Specified by:
getProcessStartTagin interfaceFileHeaderTransformer- Returns:
- the starting header tag
-
setProcessStartTag
Changes the process start tag.- Specified by:
setProcessStartTagin interfaceFileHeaderTransformer- Parameters:
processStartTag- the new start tag
-
getProcessEndTag
Obtain the process tag which indiciates the end of the header content. By default, (says if you do not explicitly invoke theFileHeaderTransformer.setProcessEndTag(String)method), will use theFileHeaderTransformer.DEFAULT_PROCESS_END_TAG.- Specified by:
getProcessEndTagin interfaceFileHeaderTransformer- Returns:
- the ending header tag
-
setProcessEndTag
Changes the process end tag.- Specified by:
setProcessEndTagin interfaceFileHeaderTransformer- Parameters:
processEndTag- the new endtag
-
getCommentStartTag
- Specified by:
getCommentStartTagin interfaceFileHeaderTransformer- Returns:
- the start tag of a comment
-
setCommentStartTag
Changes the comment start tag.- Specified by:
setCommentStartTagin interfaceFileHeaderTransformer- Parameters:
commentStartTag- the new comment start tag
-
getCommentEndTag
- Specified by:
getCommentEndTagin interfaceFileHeaderTransformer- Returns:
- the end tag of a comment
-
setCommentEndTag
Changes the comment end tag.- Specified by:
setCommentEndTagin interfaceFileHeaderTransformer- Parameters:
commentEndTag- the new comment end tag
-
getCommentLinePrefix
- Specified by:
getCommentLinePrefixin interfaceFileHeaderTransformer- Returns:
- the line prefix of every line insed the comment
-
getLineSeparator
- Specified by:
getLineSeparatorin interfaceFileHeaderTransformer
-
setLineSeparator
- Specified by:
setLineSeparatorin interfaceFileHeaderTransformer
-
addHeader
Adds the header.- Specified by:
addHeaderin interfaceFileHeaderTransformer- Parameters:
header- header to addcontent- content of original file- Returns:
- the new full file content beginning with header
-
setCommentLinePrefix
Changes the comment prefix line.- Specified by:
setCommentLinePrefixin interfaceFileHeaderTransformer- Parameters:
commentLinePrefix- the new comment prefix line
-
isEmptyLineAfterHeader
public boolean isEmptyLineAfterHeader()Get flag if there should be an empty line after the header.- Specified by:
isEmptyLineAfterHeaderin interfaceFileHeaderTransformer- Returns:
- if there should be an empty line after the header
-
setEmptyLineAfterHeader
public void setEmptyLineAfterHeader(boolean emptyLine) Set flag if there should be an empty line after the header.- Specified by:
setEmptyLineAfterHeaderin interfaceFileHeaderTransformer- Parameters:
emptyLine- flag if there should be an empty line after the header
-
isTrimHeaderLine
public boolean isTrimHeaderLine()Get flag if header line should be right trimmed when written.- Specified by:
isTrimHeaderLinein interfaceFileHeaderTransformer- Returns:
- if header line should be right trimmed when written
-
setTrimHeaderLine
public void setTrimHeaderLine(boolean trimLine) Set flag if header line should be right trimmed when written.- Specified by:
setTrimHeaderLinein interfaceFileHeaderTransformer- Parameters:
trimLine- flag if header line should be right trimmed when written
-
toFileHeader
Build aFileHeaderfrom an UNBOXED header content.- Specified by:
toFileHeaderin interfaceFileHeaderTransformer- Parameters:
header- unboxed header content- Returns:
- The model of the header content
-
toString
Build a UNBOXED header content from the givenmodel.- Specified by:
toStringin interfaceFileHeaderTransformer- Parameters:
model- the model of the file header (can not be null)- Returns:
- the UNBOXED header content
-
toHeaderContent
Build a fully boxed header content from the givenmodel.- Specified by:
toHeaderContentin interfaceFileHeaderTransformer- Parameters:
model- the model of the file header (can not be null)- Returns:
- the fully boxed header content
-
boxComment
Box the givenheaderin a comment.- Specified by:
boxCommentin interfaceFileHeaderTransformer- Parameters:
header- the header content WITHOUT any comment boxingwithTags- flag to add start and end comment tags.- Returns:
- the header content WITH comment boxing
-
unboxComent
Unbox the given boxedboxedHeaderto obtain the header content.- Specified by:
unboxComentin interfaceFileHeaderTransformer- Parameters:
header- the boxed header- Returns:
- the unboxed header.
-
boxProcessTag
Box the givenheaderbetween process tags.- Specified by:
boxProcessTagin interfaceFileHeaderTransformer- Parameters:
header- the header content WITHOUT any comment boxing- Returns:
- the header content boxed between process tags
- See Also:
-
unboxProcessTag
Unbox the process tag on the given boxedboxedHeaderto obtain the brute header content.- Specified by:
unboxProcessTagin interfaceFileHeaderTransformer- Parameters:
boxedHeader- the boxed header- Returns:
- the brute header content.
- See Also:
-
isDescriptionEquals
Tests if the description of the two models are equals.- Specified by:
isDescriptionEqualsin interfaceFileHeaderTransformer- Parameters:
header1- the first headerheader2- the second header- Returns:
trueif headers description are stricly the same
-
isCopyrightEquals
Tests if the copyright of the two models are equals.- Specified by:
isCopyrightEqualsin interfaceFileHeaderTransformer- Parameters:
header1- the first headerheader2- the second header- Returns:
trueif headers copyright are stricly the same
-
isLicenseEquals
Tests if the license of the two models are equals.- Specified by:
isLicenseEqualsin interfaceFileHeaderTransformer- Parameters:
header1- the first headerheader2- the second header- Returns:
trueif headers license are stricly the same (WITHOUT ANY space)
-