org.apache.tools.ant.util

Class RegexpPatternMapper

Implemented Interfaces:
FileNameMapper

public class RegexpPatternMapper
extends java.lang.Object
implements FileNameMapper

Implementation of FileNameMapper that does regular expression replacements.

Field Summary

protected RegexpMatcher
reg
protected StringBuffer
result
protected char[]
to

Constructor Summary

RegexpPatternMapper()

Method Summary

String[]
mapFileName(String sourceFileName)
Returns null if the source file name doesn't match the "from" pattern, an one-element array containing the translated file otherwise.
protected String
replaceReferences(String source)
Replace all backreferences in the to pattern with the matched groups of the source.
void
setFrom(String from)
Sets the "from" pattern.
void
setTo(String to)
Sets the "to" pattern.

Field Details

reg

protected RegexpMatcher reg


result

protected StringBuffer result


to

protected char[] to

Constructor Details

RegexpPatternMapper

public RegexpPatternMapper()
            throws BuildException

Method Details

mapFileName

public String[] mapFileName(String sourceFileName)
Returns null if the source file name doesn't match the "from" pattern, an one-element array containing the translated file otherwise.
Specified by:
mapFileName in interface FileNameMapper


replaceReferences

protected String replaceReferences(String source)
Replace all backreferences in the to pattern with the matched groups of the source.


setFrom

public void setFrom(String from)
            throws BuildException
Sets the "from" pattern. Required.
Specified by:
setFrom in interface FileNameMapper


setTo

public void setTo(String to)
Sets the "to" pattern. Required.
Specified by:
setTo in interface FileNameMapper


Copyright B) 2000-2005 Apache Software Foundation. All Rights Reserved.