org.codehaus.mojo.license.header.transformer
Interface FileHeaderTransformer

All Known Implementing Classes:
AbstractFileHeaderTransformer, AptFileHeaderTransformer, FreeMarkerFileHeaderTransformer, JavaFileHeaderTransformer, JspFileHeaderTransformer, PhpFileHeaderTransformer, PropertiesFileHeaderTransformer, RstFileHeaderTransformer, SqlFileHeaderTransformer, XmlFileHeaderTransformer

public interface FileHeaderTransformer

Contract to transform a file header to FileHeader in both way :

Moreover the contract offers two methods to box and unbox a String representation of a header content :

Since:
1.0
Author:
tchemit

Field Summary
static String DEFAULT_PROCESS_END_TAG
          default process end tag
static String DEFAULT_PROCESS_START_TAG
          default process start tag
static String DEFAULT_SECTION_DELIMITER
          default section delimiter
static char LINE_SEPARATOR
           
static String ROLE_NAME
          Plexus component role
 
Method Summary
 String addHeader(String header, String content)
          Adds the header.
 String boxComment(String header, boolean withTags)
          Box the given header in a comment.
 String boxProcessTag(String header)
          Box the given header between process tags.
 String getCommentEndTag()
           
 String getCommentLinePrefix()
           
 String getCommentStartTag()
           
 String[] getDefaultAcceptedExtensions()
          Get the default accepted extensions for this transformer.
 String getDescription()
           
 String getName()
           
 String getProcessEndTag()
          Obtain the process tag which indiciates the end of the header content.
 String getProcessStartTag()
          Obtains the process tag which indicates the begin of the header content.
 String getSectionDelimiter()
          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 isLicenseEquals(FileHeader header1, FileHeader header2)
          Tests if the license of the two models are equals.
 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 setName(String name)
          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.
 FileHeader toFileHeader(String header)
          Build a FileHeader from an UNBOXED header content.
 String toHeaderContent(FileHeader model)
          Build a fully boxed header content from the given model.
 String toString(FileHeader model)
          Build a UNBOXED header content from the given model.
 String unboxComent(String boxedHeader)
          Unbox the given boxed boxedHeader to obtain the header content.
 String unboxProcessTag(String boxedHeader)
          Unbox the process tag on the given boxed boxedHeader to obtain the brute header content.
 

Field Detail

ROLE_NAME

static final String ROLE_NAME
Plexus component role


DEFAULT_SECTION_DELIMITER

static final String DEFAULT_SECTION_DELIMITER
default section delimiter

See Also:
Constant Field Values

DEFAULT_PROCESS_START_TAG

static final String DEFAULT_PROCESS_START_TAG
default process start tag

See Also:
Constant Field Values

DEFAULT_PROCESS_END_TAG

static final String DEFAULT_PROCESS_END_TAG
default process end tag

See Also:
Constant Field Values

LINE_SEPARATOR

static final char LINE_SEPARATOR
See Also:
Constant Field Values
Method Detail

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 the setProcessStartTag(String) method), will use the DEFAULT_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 the setProcessEndTag(String) method), will use the DEFAULT_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 the setSectionDelimiter(String) method), will use the DEFAULT_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

addHeader

String addHeader(String header,
                 String content)
Adds the header.

Parameters:
header - header to add
content - content of original file
Returns:
the new full file content beginning with header

boxComment

String boxComment(String header,
                  boolean withTags)
Box the given header in a comment.

Parameters:
header - the header content WITHOUT any comment boxing
withTags - flag to add start and end comment tags.
Returns:
the header content WITH comment boxing

unboxComent

String unboxComent(String boxedHeader)
Unbox the given boxed boxedHeader to obtain the header content.

Parameters:
boxedHeader - the boxed header
Returns:
the unboxed header.

boxProcessTag

String boxProcessTag(String header)
Box the given header between process tags.

Parameters:
header - the header content WITHOUT any comment boxing
Returns:
the header content boxed between process tags
See Also:
getProcessStartTag(), getProcessEndTag()

unboxProcessTag

String unboxProcessTag(String boxedHeader)
Unbox the process tag on the given boxed boxedHeader to obtain the brute header content.

Parameters:
boxedHeader - the boxed header
Returns:
the brute header content.
See Also:
getProcessStartTag(), getProcessEndTag()

toFileHeader

FileHeader toFileHeader(String header)
Build a FileHeader from an UNBOXED header content.

Parameters:
header - unboxed header content
Returns:
The model of the header content

toString

String toString(FileHeader model)
                throws NullPointerException
Build a UNBOXED header content from the given model.

Parameters:
model - the model of the file header
Returns:
the UNBOXED header content
Throws:
NullPointerException - if model is null

toHeaderContent

String toHeaderContent(FileHeader model)
                       throws NullPointerException
Build a fully boxed header content from the given model.

Parameters:
model - the model of the file header
Returns:
the fully boxed header content
Throws:
NullPointerException - if model is null

isDescriptionEquals

boolean isDescriptionEquals(FileHeader header1,
                            FileHeader header2)
Tests if the description of the two models are equals.

Parameters:
header1 - the first header
header2 - the second header
Returns:
true if headers description are stricly the same

isCopyrightEquals

boolean isCopyrightEquals(FileHeader header1,
                          FileHeader header2)
Tests if the copyright of the two models are equals.

Parameters:
header1 - the first header
header2 - the second header
Returns:
true if headers copyright are stricly the same

isLicenseEquals

boolean isLicenseEquals(FileHeader header1,
                        FileHeader header2)
Tests if the license of the two models are equals.

Parameters:
header1 - the first header
header2 - the second header
Returns:
true if headers license are stricly the same (WITHOUT ANY space)

setName

void setName(String name)
Changes the name of the transformer.

Parameters:
name - the new name of the transformer

setDescription

void setDescription(String description)
Chages the description of the transformer.

Parameters:
description - the new description of the transformer

setSectionDelimiter

void setSectionDelimiter(String headerSectionDelimiter)
Sets the header section delimiter.

By default, will use the DEFAULT_SECTION_DELIMITER.

Parameters:
headerSectionDelimiter - the new delimiter

setProcessStartTag

void setProcessStartTag(String tag)
Changes the process start tag.

Parameters:
tag - the new start tag

setProcessEndTag

void setProcessEndTag(String tag)
Changes the process end tag.

Parameters:
tag - the new endtag

setCommentStartTag

void setCommentStartTag(String commentStartTag)
Changes the comment start tag.

Parameters:
commentStartTag - the new comment start tag

setCommentEndTag

void setCommentEndTag(String commentEndTag)
Changes the comment end tag.

Parameters:
commentEndTag - the new comment end tag

setCommentLinePrefix

void setCommentLinePrefix(String commentLinePrefix)
Changes the comment prefix line.

Parameters:
commentLinePrefix - the new comment prefix line


Copyright © 2010-2012 The Kuali Foundation. All Rights Reserved.