Class AbstractFileParser

java.lang.Object
org.nuiton.i18n.plugin.parser.AbstractFileParser
All Implemented Interfaces:
FileParser
Direct Known Subclasses:
AbstractParserXmlMojo.XmlFileParser, ParserGWTJavaMojo.GWTJavaFileParser, ParserJavaMojo.JavaFileParser, ParserStruts2Mojo.Struts2JspFileParser

public abstract class AbstractFileParser
extends java.lang.Object
implements FileParser
A abstract implementation of a FileParser with no logic.
Since:
1.2
Author:
Tony Chemit - chemit@codelutin.com
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.util.regex.Pattern acceptKeyPattern  
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected AbstractFileParser​(org.apache.maven.plugin.logging.Log log, java.lang.String encoding, org.nuiton.io.SortedProperties oldParser, java.util.regex.Pattern acceptKeyPattern, boolean showTouchedFiles)  
  • Method Summary

    Modifier and Type Method Description
    void destroy()
    clean file parser.
    protected void finalize()  
    java.lang.String getEncoding()
    Gets encoding used to read and write files.
    org.apache.maven.plugin.logging.Log getLog()  
    org.nuiton.io.SortedProperties getResult()
    TODO As we do not used anylonger old language, we should directly TODO use only a set of keys, no need to keep i18n value...
    boolean isShowTouchedFiles()  
    boolean isTouched()  
    protected java.io.File prepareFile​(java.io.File file)
    To prepare the file (if any thing to be done before scanning it).
    protected void registerKey​(java.lang.String key)
    Method to invoke when a i18n key was detected .
    protected void setTouched​(boolean touched)  

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.nuiton.i18n.plugin.parser.FileParser

    parseFile, parseLine
  • Field Details

  • Constructor Details

    • AbstractFileParser

      protected AbstractFileParser​(org.apache.maven.plugin.logging.Log log, java.lang.String encoding, org.nuiton.io.SortedProperties oldParser, java.util.regex.Pattern acceptKeyPattern, boolean showTouchedFiles)
  • Method Details

    • isShowTouchedFiles

      public boolean isShowTouchedFiles()
    • isTouched

      public boolean isTouched()
      Specified by:
      isTouched in interface FileParser
      Returns:
      true if file was touched (says contains at least one i18n key)
    • getResult

      public org.nuiton.io.SortedProperties getResult()
      Description copied from interface: FileParser
      TODO As we do not used anylonger old language, we should directly TODO use only a set of keys, no need to keep i18n value...
      Specified by:
      getResult in interface FileParser
      Returns:
      the results of i18n keys found for the given file
    • getEncoding

      public java.lang.String getEncoding()
      Description copied from interface: FileParser
      Gets encoding used to read and write files.
      Specified by:
      getEncoding in interface FileParser
      Returns:
      the encoding
    • destroy

      public void destroy()
      Description copied from interface: FileParser
      clean file parser.
      Specified by:
      destroy in interface FileParser
    • finalize

      protected void finalize() throws java.lang.Throwable
      Overrides:
      finalize in class java.lang.Object
      Throws:
      java.lang.Throwable
    • getLog

      public org.apache.maven.plugin.logging.Log getLog()
    • registerKey

      protected void registerKey​(java.lang.String key)
      Method to invoke when a i18n key was detected .
      Parameters:
      key - the i18n key to register
    • setTouched

      protected void setTouched​(boolean touched)
    • prepareFile

      protected java.io.File prepareFile​(java.io.File file) throws java.io.IOException
      To prepare the file (if any thing to be done before scanning it). By default do nothing, use directly the input file.
      Parameters:
      file - the incoming file
      Returns:
      the real file to process
      Throws:
      java.io.IOException - if any IO problem while preparing file
      Since:
      2.1