Interface FileHeaderTransformer
- All Known Implementing Classes:
AbstractFileHeaderTransformer
,AptFileHeaderTransformer
,FreeMarkerFileHeaderTransformer
,HtmlFileHeaderTransformer
,JavaFileHeaderTransformer
,JspFileHeaderTransformer
,MySqlFileHeaderTransformer
,PhpFileHeaderTransformer
,PropertiesFileHeaderTransformer
,RstFileHeaderTransformer
,SqlFileHeaderTransformer
,XmlFileHeaderTransformer
public interface FileHeaderTransformer
Contract to transform a file header to
FileHeader
in both way :
- Obtain a object representation of a file header from a existing file (String to FileHeader).
- Obtain the file header to inject in a file from a FileHeader (to update or create a file header from the file header model).
- Since:
- 1.0
- Author:
- tchemit dev@tchemit.fr
-
Field Summary
Fields -
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.String[]
Get the default accepted extensions for this transformer.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 tag) Changes the process end tag.void
setProcessStartTag
(String tag) Changes the process start tag.void
setSectionDelimiter
(String headerSectionDelimiter) 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 boxedHeader) 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.
-
Field Details
-
DEFAULT_SECTION_DELIMITER
default section delimiter.- See Also:
-
DEFAULT_PROCESS_START_TAG
default process start tag.- See Also:
-
DEFAULT_PROCESS_END_TAG
default process end tag.- See Also:
-
LINE_SEPARATOR
Line separator.
-
-
Method Details
-
getName
String getName()- Returns:
- the name of the transformer
-
getDescription
String getDescription()- Returns:
- the description of the transformer
-
getDefaultAcceptedExtensions
String[] getDefaultAcceptedExtensions()Get the default accepted extensions for this transformer.- Returns:
- the default accepted extensions.
-
getProcessStartTag
String getProcessStartTag()Obtains the process tag which indicates the begin of the header content. By default, (says if you do not explicitly invoke thesetProcessStartTag(String)
method), will use theDEFAULT_PROCESS_START_TAG
- Returns:
- the starting header tag
-
getProcessEndTag
String getProcessEndTag()Obtain the process tag which indiciates the end of the header content. By default, (says if you do not explicitly invoke thesetProcessEndTag(String)
method), will use theDEFAULT_PROCESS_END_TAG
.- Returns:
- the ending header tag
-
getSectionDelimiter
String getSectionDelimiter()The pattern used to separate sections of the header. By default, (says if you do not explicitly invoke thesetSectionDelimiter(String)
method), will use theDEFAULT_SECTION_DELIMITER
.- Returns:
- the delimiter used to separate sections in the header.
-
getCommentStartTag
String getCommentStartTag()- Returns:
- the start tag of a comment
-
getCommentEndTag
String getCommentEndTag()- Returns:
- the end tag of a comment
-
getCommentLinePrefix
String getCommentLinePrefix()- Returns:
- the line prefix of every line insed the comment
-
getLineSeparator
String getLineSeparator() -
isEmptyLineAfterHeader
boolean isEmptyLineAfterHeader()Get flag if there should be an empty line after the header.- Returns:
- if there should be an empty line after the header
-
isTrimHeaderLine
boolean isTrimHeaderLine()Get flag if header line should be right trimmed when written.- Returns:
- if header line should be right trimmed when written
-
addHeader
Adds the header.- Parameters:
header
- header to addcontent
- content of original file- Returns:
- the new full file content beginning with header
-
boxComment
Box the givenheader
in a comment.- 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.- Parameters:
boxedHeader
- the boxed header- Returns:
- the unboxed header.
-
boxProcessTag
Box the givenheader
between process tags.- 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.- Parameters:
boxedHeader
- the boxed header- Returns:
- the brute header content.
- See Also:
-
toFileHeader
Build aFileHeader
from an UNBOXED header content.- Parameters:
header
- unboxed header content- Returns:
- The model of the header content
-
toString
Build a UNBOXED header content from the givenmodel
.- 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
.- Parameters:
model
- the model of the file header (can not be null)- Returns:
- the fully boxed header content
-
isDescriptionEquals
Tests if the description of the two models are equals.- 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.- 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.- Parameters:
header1
- the first headerheader2
- the second header- Returns:
true
if headers license are stricly the same (WITHOUT ANY space)
-
setName
Changes the name of the transformer.- Parameters:
name
- the new name of the transformer
-
setDescription
Chages the description of the transformer.- Parameters:
description
- the new description of the transformer
-
setSectionDelimiter
Sets the header section delimiter. By default, will use theDEFAULT_SECTION_DELIMITER
.- Parameters:
headerSectionDelimiter
- the new delimiter
-
setProcessStartTag
Changes the process start tag.- Parameters:
tag
- the new start tag
-
setProcessEndTag
Changes the process end tag.- Parameters:
tag
- the new endtag
-
setCommentStartTag
Changes the comment start tag.- Parameters:
commentStartTag
- the new comment start tag
-
setCommentEndTag
Changes the comment end tag.- Parameters:
commentEndTag
- the new comment end tag
-
setCommentLinePrefix
Changes the comment prefix line.- Parameters:
commentLinePrefix
- the new comment prefix line
-
setEmptyLineAfterHeader
void setEmptyLineAfterHeader(boolean emptyLine) Set flag if there should be an empty line after the header.- Parameters:
emptyLine
- flag if there should be an empty line after the header
-
setTrimHeaderLine
void setTrimHeaderLine(boolean trimLine) Set flag if header line should be right trimmed when written.- Parameters:
trimLine
- flag if header line should be right trimmed when written
-
setLineSeparator
-