public class PrefixedFileLinkDefinition extends Object implements FileLinkDefinition
| Constructor and Description |
|---|
PrefixedFileLinkDefinition(String name,
String prefix,
String extension) |
PrefixedFileLinkDefinition(String name,
String prefix,
String extension,
String lineNumberDelimiter) |
| Modifier and Type | Method and Description |
|---|---|
protected String |
generateLineNumberExpression(String lineNumberDelimiter) |
static String |
getConsecutiveNumbers(String text)
This returns the first grouping of consecutive numbers.
|
static int |
getLineNumber(String textAfterPath,
String lineNumberDelimiter) |
String |
getName() |
String |
getSearchExpression() |
int |
parseFileLink(String fullSearchTest,
String matchedText,
int start,
int end,
boolean verifyFileExists,
List<FileLink> fileLinks)
This is called for each match.
|
static String |
quoteLiteral(String literal) |
String |
toString() |
public PrefixedFileLinkDefinition(String name, String prefix, String extension)
public PrefixedFileLinkDefinition(String name, String prefix, String extension, String lineNumberDelimiter)
name - the name of this file link definition. Used by tests mostly.prefix - the text that is before the file path. It should be enough to make it fairly uniqueextension - the expected file extension. If we don't find this extension, we do not consider the text a file's path. If there are multiple extensions, you'll have to add multiples of
these.lineNumberDelimiter - optional delimiter text for line number. Whatever is after this will be assumed to be a line number. We'll only parse the numbers after this so there can be other
stuff after the line number. Pass in null to ignore.public String getName()
getName in interface FileLinkDefinitionprotected String generateLineNumberExpression(String lineNumberDelimiter)
public String getSearchExpression()
getSearchExpression in interface FileLinkDefinitionpublic int parseFileLink(String fullSearchTest, String matchedText, int start, int end, boolean verifyFileExists, List<FileLink> fileLinks)
parseFileLink in interface FileLinkDefinitionfullSearchTest - the full text that was searchedmatchedText - the text that was matchedstart - the index into the entire searched text where the matchedText startsend - the index into the entire searched text where the matchedText endspublic static String getConsecutiveNumbers(String text)
text - the text to searchCopyright © 2013. All rights reserved