org.codehaus.mojo.taglist.tags
Class AbsTag

java.lang.Object
  extended by org.codehaus.mojo.taglist.tags.AbsTag
Direct Known Subclasses:
GenericTag, IgnoreCaseTag, RegExTag

public abstract class AbsTag
extends Object

The abstract base class for tags. This class defines the required functions that each type of tag must implement. The goal here is to allow different types of tags to be created by the user, but the call processing for each tag can be generic. For example, a generic tag might search files for an exact string match of the tag, but a regex tag will use regular expressions in its searching. Either way, the processing classes call each tag with the same function and get the same results.


Field Summary
protected  String tagString
          The tag string for this tag.
 
Constructor Summary
protected AbsTag(String tag)
          Constructor.
 
Method Summary
abstract  int contains(String currentLine, Locale locale)
          Check to see if the string contains this tag.
abstract  int getLastTagMatchLength()
          Return the length of the last matched tag.
abstract  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
 

Field Detail

tagString

protected String tagString
The tag string for this tag. The string here is generic, and its use is defined by the derived tag objects.

Constructor Detail

AbsTag

protected AbsTag(String tag)
Constructor.

Parameters:
tag - the tag string to be used for this tag.
Method Detail

contains

public abstract 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.

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 abstract boolean startsWith(String currentLine,
                                   Locale locale)
Check to see if the string starts with this tag. If there is a match, return true.

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 abstract int getLastTagMatchLength()
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.


Copyright © 2005-2012 Codehaus. All Rights Reserved.