org.codehaus.mojo.taglist.tags
Class RegExTag

java.lang.Object
  extended by org.codehaus.mojo.taglist.tags.AbsTag
      extended by org.codehaus.mojo.taglist.tags.RegExTag

public class RegExTag
extends AbsTag

The regular expression tag class. This class defines a regular express tag search. This tag will match if the regular express string listed is found within the scanned lines. Example POM:

   
       ...
       fixme[0-9]
      regEx
       ...
   
  
Example Java code with match:
    fixme1 this will match (fixme followed by one digit.)
  
Example Java code without match:
     fixme this will NOT match (no digit after fixme)
  


Field Summary
 
Fields inherited from class org.codehaus.mojo.taglist.tags.AbsTag
tagString
 
Constructor Summary
RegExTag(String tagString)
          Constructor.
 
Method Summary
 int contains(String currentLine, Locale locale)
          Check to see if the string contains this tag.
 int getLastTagMatchLength()
          Return the length of the last matched tag.
 boolean startsWith(String currentLine, Locale locale)
          Check to see if the string starts with this tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegExTag

public RegExTag(String tagString)
Constructor.

Parameters:
tagString - the string to match against for this tag.
Method Detail

contains

public int contains(String currentLine,
                    Locale locale)
Check to see if the string contains this tag. If there is a match, return the index within the string; otherwise, return NO_MATCH.

Specified by:
contains in class AbsTag
Parameters:
currentLine - the string for the current line being scanned.
locale - the Locale of the currentLine.
Returns:
the index within the string of the matched tag, or TagClass.NO_MATCH if not match was found.

startsWith

public boolean startsWith(String currentLine,
                          Locale locale)
Check to see if the string starts with this tag.

Specified by:
startsWith in class AbsTag
Parameters:
currentLine - the string for the current line being scanned.
locale - the Locale of the currentLine.
Returns:
true if the string starts with this tag.

getLastTagMatchLength

public int getLastTagMatchLength()
Return the length of the last matched tag. A regular expression tag might be 10 characters; however, the matched string may only be 5. Example: regEx tag: a*b (tag length = 3) matched comment: aaabbb (comment length = 6) In the above example, this function will return 6.

Specified by:
getLastTagMatchLength in class AbsTag
Returns:
the length of the last matched tag.


Copyright © 2005-2014 Codehaus. All Rights Reserved.