RegexpPatternMapper (Apache Ant API)
Date: 2012-02-26

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tools.ant.util
Class RegexpPatternMapper

    java.lang.Object
      org.apache.tools.ant.util.RegexpPatternMapper

All 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 java.lang.StringBuffer` | `result`
`protected char[]` | `to`

Constructor Summary
`RegexpPatternMapper()` Constructor for RegexpPatternMapper.

Method Summary
`java.lang.String[]` | `mapFileName(java.lang.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 java.lang.String` | `replaceReferences(java.lang.String source)` Replace all backreferences in the to pattern with the matched groups of the source.
`void` | `setCaseSensitive(boolean caseSensitive)` Attribute specifing whether to ignore the case difference in the names.
`void` | `setFrom(java.lang.String from)` Sets the "from" pattern.
`void` | `setHandleDirSep(boolean handleDirSep)` Attribute specifing whether to ignore the difference between / and \ (the two common directory characters).
`void` | `setTo(java.lang.String to)` Sets the "to" pattern.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### reg

    protected RegexpMatcher reg

### to

    protected char[] to

### result

    protected java.lang.StringBuffer result

Constructor Detail

### RegexpPatternMapper

    public RegexpPatternMapper()
                        throws BuildException

  Constructor for RegexpPatternMapper.

  Throws:
    `BuildException` - on error.

Method Detail

### setHandleDirSep

    public void setHandleDirSep(boolean handleDirSep)

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

  Parameters:
    `handleDirSep` - a boolean, default is false.
  Since:
    Ant 1.6.3

### setCaseSensitive

    public void setCaseSensitive(boolean caseSensitive)

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

  Parameters:
    `caseSensitive` - a boolean, default is false.
  Since:
    Ant 1.6.3

### setFrom

    public void setFrom(java.lang.String from)
                 throws BuildException

  Sets the "from" pattern. Required.

  Specified by:
    `setFrom` in interface `FileNameMapper`
  Parameters:
    `from` - the from pattern.
  Throws:
    `BuildException` - on error.

### setTo

    public void setTo(java.lang.String to)

  Sets the "to" pattern. Required.

  Specified by:
    `setTo` in interface `FileNameMapper`
  Parameters:
    `to` - the to pattern.
  Throws:
    `BuildException` - on error.

### mapFileName

    public java.lang.String[] mapFileName(java.lang.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`
  Parameters:
    `sourceFileName` - the source file name
  Returns:
    a one-element array containing the translated file or null if the to pattern did not match

### replaceReferences

    protected java.lang.String replaceReferences(java.lang.String source)

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

  Parameters:
    `source` - the source file name.
  Returns:
    the translated file name.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD