UnPackageNameMapper (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.util, class: UnPackageNameMapper

# Class UnPackageNameMapper

java.lang.Object
org.apache.tools.ant.util.GlobPatternMapper
org.apache.tools.ant.util.UnPackageNameMapper

All Implemented Interfaces:
  `FileNameMapper`

public class UnPackageNameMapper extends GlobPatternMapper
Maps dotted package name matches to a directory name. This is the inverse of the package mapper. This is useful for matching XML formatter results against their JUnit test cases.

    <mapper classname="org.apache.tools.ant.util.UnPackageNameMapper"
            from="${test.data.dir}/TEST-*Test.xml" to="*Test.java">

- ## Field Summary

  ### Fields inherited from class GlobPatternMapper

  `fromPostfix, fromPrefix, postfixLength, prefixLength, toPostfix, toPrefix`
  Modifier and Type
  Field
  Description
  `protected String`
  `fromPostfix`
  Part of "from" pattern after the *.
  `protected String`
  `fromPrefix`
  Part of "from" pattern before the *.
  `protected int`
  `postfixLength`
  Length of the postfix ("from" pattern).
  `protected int`
  `prefixLength`
  Length of the prefix ("from" pattern).
  `protected String`
  `toPostfix`
  Part of "to" pattern after the *.
  `protected String`
  `toPrefix`
  Part of "to" pattern before the *.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `UnPackageNameMapper()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected String`
  `extractVariablePart(String name)`
  Returns the part of the given string that matches the * in the "from" pattern replacing dots with file separators

  ### Methods inherited from class GlobPatternMapper

  `getHandleDirSep, mapFileName, setCaseSensitive, setFrom, setHandleDirSep, setTo`
  Modifier and Type
  Method
  Description
  `boolean`
  `getHandleDirSep()`
  Attribute specifying whether to ignore the difference between / and \ (the two common directory characters).
  `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.
  `void`
  `setCaseSensitive(boolean caseSensitive)`
  Attribute specifying whether to ignore the case difference in the names.
  `void`
  `setFrom(String from)`
  Sets the "from" pattern.
  `void`
  `setHandleDirSep(boolean handleDirSep)`
  Attribute specifying whether to ignore the difference between / and \ (the two common directory characters).
  `void`
  `setTo(String to)`
  Sets the "to" pattern.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### UnPackageNameMapper

    public UnPackageNameMapper()

- ## Method Details

  - ### extractVariablePart

    protected String extractVariablePart(String name)
    Returns the part of the given string that matches the * in the "from" pattern replacing dots with file separators
    Overrides:
      `extractVariablePart` in class `GlobPatternMapper`
    Parameters:
      `name` - Source filename
    Returns:
      Replaced variable part