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 givenheader
in a comment.boxProcessTag
(String header) Box the givenheader
between 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.boolean
isCopyrightEquals
(FileHeader header1, FileHeader header2) Tests if the copyright of the two models are equals.boolean
isDescriptionEquals
(FileHeader header1, FileHeader header2) Tests if the description of the two models are equals.boolean
Get flag if there should be an empty line after the header.boolean
isLicenseEquals
(FileHeader header1, FileHeader header2) Tests if the license of the two models are equals.boolean
Get flag if header line should be right trimmed when written.void
setCommentEndTag
(String commentEndTag) Changes the comment end tag.void
setCommentLinePrefix
(String commentLinePrefix) Changes the comment prefix line.void
setCommentStartTag
(String commentStartTag) Changes the comment start tag.void
setDescription
(String description) Chages the description of the transformer.void
setEmptyLineAfterHeader
(boolean emptyLine) Set flag if there should be an empty line after the header.void
setLineSeparator
(String lineSeparator) void
Changes the name of the transformer.void
setProcessEndTag
(String processEndTag) Changes the process end tag.void
setProcessStartTag
(String processStartTag) Changes the process start tag.void
setSectionDelimiter
(String sectionDelimiter) Sets the header section delimiter.void
setTrimHeaderLine
(boolean trimLine) Set flag if header line should be right trimmed when written.toFileHeader
(String header) Build aFileHeader
from 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 boxedboxedHeader
to obtain the header content.unboxProcessTag
(String boxedHeader) Unbox the process tag on the given boxedboxedHeader
to obtain the brute header content.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.codehaus.mojo.license.header.transformer.FileHeaderTransformer
getDefaultAcceptedExtensions
-
Constructor Details
-
AbstractFileHeaderTransformer
-
-
Method Details
-
getName
- Specified by:
getName
in interfaceFileHeaderTransformer
- Returns:
- the name of the transformer
-
setName
Changes the name of the transformer.- Specified by:
setName
in interfaceFileHeaderTransformer
- Parameters:
name
- the new name of the transformer
-
getDescription
- Specified by:
getDescription
in interfaceFileHeaderTransformer
- Returns:
- the description of the transformer
-
setDescription
Chages the description of the transformer.- Specified by:
setDescription
in 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:
getSectionDelimiter
in 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:
setSectionDelimiter
in 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:
getProcessStartTag
in interfaceFileHeaderTransformer
- Returns:
- the starting header tag
-
setProcessStartTag
Changes the process start tag.- Specified by:
setProcessStartTag
in 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:
getProcessEndTag
in interfaceFileHeaderTransformer
- Returns:
- the ending header tag
-
setProcessEndTag
Changes the process end tag.- Specified by:
setProcessEndTag
in interfaceFileHeaderTransformer
- Parameters:
processEndTag
- the new endtag
-
getCommentStartTag
- Specified by:
getCommentStartTag
in interfaceFileHeaderTransformer
- Returns:
- the start tag of a comment
-
setCommentStartTag
Changes the comment start tag.- Specified by:
setCommentStartTag
in interfaceFileHeaderTransformer
- Parameters:
commentStartTag
- the new comment start tag
-
getCommentEndTag
- Specified by:
getCommentEndTag
in interfaceFileHeaderTransformer
- Returns:
- the end tag of a comment
-
setCommentEndTag
Changes the comment end tag.- Specified by:
setCommentEndTag
in interfaceFileHeaderTransformer
- Parameters:
commentEndTag
- the new comment end tag
-
getCommentLinePrefix
- Specified by:
getCommentLinePrefix
in interfaceFileHeaderTransformer
- Returns:
- the line prefix of every line insed the comment
-
getLineSeparator
- Specified by:
getLineSeparator
in interfaceFileHeaderTransformer
-
setLineSeparator
- Specified by:
setLineSeparator
in interfaceFileHeaderTransformer
-
addHeader
Adds the header.- Specified by:
addHeader
in 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:
setCommentLinePrefix
in 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:
isEmptyLineAfterHeader
in 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:
setEmptyLineAfterHeader
in 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:
isTrimHeaderLine
in 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:
setTrimHeaderLine
in interfaceFileHeaderTransformer
- Parameters:
trimLine
- flag if header line should be right trimmed when written
-
toFileHeader
Build aFileHeader
from an UNBOXED header content.- Specified by:
toFileHeader
in interfaceFileHeaderTransformer
- Parameters:
header
- unboxed header content- Returns:
- The model of the header content
-
toString
Build a UNBOXED header content from the givenmodel
.- Specified by:
toString
in 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:
toHeaderContent
in interfaceFileHeaderTransformer
- Parameters:
model
- the model of the file header (can not be null)- Returns:
- the fully boxed header content
-
boxComment
Box the givenheader
in a comment.- Specified by:
boxComment
in 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 boxedboxedHeader
to obtain the header content.- Specified by:
unboxComent
in interfaceFileHeaderTransformer
- Parameters:
header
- the boxed header- Returns:
- the unboxed header.
-
boxProcessTag
Box the givenheader
between process tags.- Specified by:
boxProcessTag
in 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 boxedboxedHeader
to obtain the brute header content.- Specified by:
unboxProcessTag
in 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:
isDescriptionEquals
in interfaceFileHeaderTransformer
- Parameters:
header1
- the first headerheader2
- the second header- Returns:
true
if headers description are stricly the same
-
isCopyrightEquals
Tests if the copyright of the two models are equals.- Specified by:
isCopyrightEquals
in interfaceFileHeaderTransformer
- Parameters:
header1
- the first headerheader2
- the second header- Returns:
true
if headers copyright are stricly the same
-
isLicenseEquals
Tests if the license of the two models are equals.- Specified by:
isLicenseEquals
in interfaceFileHeaderTransformer
- Parameters:
header1
- the first headerheader2
- the second header- Returns:
true
if headers license are stricly the same (WITHOUT ANY space)
-