org.codehaus.mojo.taglist.tags
Class TagClass

java.lang.Object
  extended by org.codehaus.mojo.taglist.tags.TagClass

public class TagClass
extends Object

Class that define a classification of tags. Each tag class contains 1 or more tags. This allows a user to define one tag "name" for display purposes, while still checking the files for multiple tag rules. Example

   
    Action Items
    
     
      todo
      ignoreCase
     
    
   
  


Field Summary
static int NO_MATCH
          The int value for no tag match found.
 
Constructor Summary
TagClass(String displayName)
          Constructor.
 
Method Summary
 void addTag(AbsTag tag)
          Add a tag to this tag class.
 String getDisplayName()
          Get the display name of this tag class.
 String getLastTagMatchString()
          Return the tag string for the last successfully matched tag.
 int getLastTagMatchStringLength()
          Return the length of the last matched tag.
 TagReport getTagReport()
          Access the tag report for this tag class.
 int tagMatchContains(String currentLine, Locale locale)
          Get the index of the first tag contained from within a string.
 boolean tagMatchStartsWith(String currentLine, Locale locale)
          Check if a string starts with a tag from this tag class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_MATCH

public static final int NO_MATCH
The int value for no tag match found.

See Also:
Constant Field Values
Constructor Detail

TagClass

public TagClass(String displayName)
Constructor.

Parameters:
displayName - the string to display as the name for this tag class.
Method Detail

getTagReport

public TagReport getTagReport()
Access the tag report for this tag class.

Returns:
the tag class's tag report.

addTag

public void addTag(AbsTag tag)
Add a tag to this tag class.

Parameters:
tag - the tag to add to the tag class.

tagMatchContains

public int tagMatchContains(String currentLine,
                            Locale locale)
Get the index of the first tag contained from within a string. The tag class will check each for its tags until a match is found within the specified string. If no match is found, this function will return TagClass.NO_MATCH for the index.

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.

tagMatchStartsWith

public boolean tagMatchStartsWith(String currentLine,
                                  Locale locale)
Check if a string starts with a tag from this tag class. The tag class will check each of its tags until the start of the string matched one of the tags. If not match if found, false is returned.

Parameters:
currentLine - the string for the current line being scanned.
locale - the Locale of the currentLine.
Returns:
true if the string starts with a tag within this tag class. Otherwise false is returned.

getLastTagMatchString

public String getLastTagMatchString()
Return the tag string for the last successfully matched tag.

Returns:
string of the last matched tag.

getLastTagMatchStringLength

public int getLastTagMatchStringLength()
Return the length of the last matched tag. Normally this is the length of the tag; however, some tags are dynamic. For example a regular expression tag might be 10 characters; however, the matched string may only be 5. Calling this function allows the tag object to return the correct length for the last matched tag.

Returns:
the length of the last matched tag.

getDisplayName

public String getDisplayName()
Get the display name of this tag class.

Returns:
the tag class display name.


Copyright © 2005-2012 Codehaus. All Rights Reserved.