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).
Moreover the contract offers two methods to box and unbox a String representation of a header content :
Since:
1.0
Author:
tchemit dev@tchemit.fr
  • Field Details

    • DEFAULT_SECTION_DELIMITER

      static final String DEFAULT_SECTION_DELIMITER
      default section delimiter.
      See Also:
    • DEFAULT_PROCESS_START_TAG

      static final String DEFAULT_PROCESS_START_TAG
      default process start tag.
      See Also:
    • DEFAULT_PROCESS_END_TAG

      static final String DEFAULT_PROCESS_END_TAG
      default process end tag.
      See Also:
    • LINE_SEPARATOR

      static final String 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 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
    • 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

      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:
    • 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:
    • 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)
      Build a UNBOXED header content from the given model.
      Parameters:
      model - the model of the file header (can not be null)
      Returns:
      the UNBOXED header content
    • toHeaderContent

      String toHeaderContent(FileHeader model)
      Build a fully boxed header content from the given model.
      Parameters:
      model - the model of the file header (can not be null)
      Returns:
      the fully boxed header content
    • 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
    • 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

      void setLineSeparator(String lineSeparator)