Top Description Fields Constructors Methods
org.apache.tools.ant.util

public Class RegexpPatternMapper

extends Object
implements FileNameMapper
Class Inheritance
All Implemented Interfaces
org.apache.tools.ant.util.FileNameMapper
Imports
java.util.List, org.apache.tools.ant.BuildException, org.apache.tools.ant.util.regexp.RegexpMatcher, .RegexpMatcherFactory, .RegexpUtil

Implementation of FileNameMapper that does regular expression replacements.

Field Summary

Modifier and TypeField and Description
private static final int
private boolean
protected RegexpMatcher
private int
protected StringBuffer
protected char[]

Constructor Summary

AccessConstructor and Description
public
RegexpPatternMapper()

Constructor for RegexpPatternMapper.

Method Summary

Modifier and TypeMethod and Description
public String[]

Returns:

a one-element array containing the translated file or null if the to pattern did not match
mapFileName
(String
the source file name
sourceFileName
)

Implements org.apache.tools.ant.util.FileNameMapper.mapFileName.

Returns null if the source file name doesn't match the "from" pattern, an one-element array containing the translated file otherwise.
protected String

Returns:

the translated file name.
replaceReferences
(String
the source file name.
source
)

Replace all backreferences in the to pattern with the matched groups of the source.

public void
setCaseSensitive(boolean
a boolean, default is false.
caseSensitive
)

Attribute specifying whether to ignore the case difference in the names.

public void
setFrom(String
the from pattern.
from
)

Implements org.apache.tools.ant.util.FileNameMapper.setFrom.

Sets the "from" pattern.
public void
setHandleDirSep(boolean
a boolean, default is false.
handleDirSep
)

Attribute specifying whether to ignore the difference between / and \ (the two common directory characters).

public void
setTo(String
the to pattern.
to
)

Implements org.apache.tools.ant.util.FileNameMapper.setTo.

Sets the "to" pattern.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DECIMALback to summary
private static final int DECIMAL
handleDirSepback to summary
private boolean handleDirSep
regback to summary
protected RegexpMatcher reg
regexpOptionsback to summary
private int regexpOptions
resultback to summary
protected StringBuffer result
toback to summary
protected char[] to

Constructor Detail

RegexpPatternMapperback to summary
public RegexpPatternMapper() throws BuildException

Constructor for RegexpPatternMapper.

Exceptions
BuildException:
on error.

Method Detail

mapFileNameback to summary
public String[] mapFileName(String sourceFileName)

Implements org.apache.tools.ant.util.FileNameMapper.mapFileName.

Returns null if the source file name doesn't match the "from" pattern, an one-element array containing the translated file otherwise.

Parameters
sourceFileName:String

the source file name

Returns:String[]

a one-element array containing the translated file or null if the to pattern did not match

Annotations
@Override
replaceReferencesback to summary
protected String replaceReferences(String source)

Replace all backreferences in the to pattern with the matched groups of the source.

Parameters
source:String

the source file name.

Returns:String

the translated file name.

setCaseSensitiveback to summary
public void setCaseSensitive(boolean caseSensitive)

Attribute specifying whether to ignore the case difference in the names.

Parameters
caseSensitive:boolean

a boolean, default is false.

Since
Ant 1.6.3
setFromback to summary
public void setFrom(String from) throws BuildException

Implements org.apache.tools.ant.util.FileNameMapper.setFrom.

Sets the "from" pattern. Required.

Parameters
from:String

the from pattern.

Annotations
@Override
Exceptions
BuildException:
on error.
setHandleDirSepback to summary
public void setHandleDirSep(boolean handleDirSep)

Attribute specifying whether to ignore the difference between / and \ (the two common directory characters).

Parameters
handleDirSep:boolean

a boolean, default is false.

Since
Ant 1.6.3
setToback to summary
public void setTo(String to)

Implements org.apache.tools.ant.util.FileNameMapper.setTo.

Sets the "to" pattern. Required.

Parameters
to:String

the to pattern.

Annotations
@Override
Exceptions
BuildException:
on error.