org.apache.tools.ant
Class Path

java.lang.Object
  |
  +--org.apache.tools.ant.Path

public class Path
extends java.lang.Object

This object represents a path as used by CLASSPATH or PATH environment variable. <sometask>
  <somepath>     <pathelement location="/path/to/file.jar" />     <pathelement path="/path/to/file2.jar:/path/to/class2;/path/to/class3" />     <pathelement location="/path/to/file3.jar" />     <pathelement location="/path/to/file4.jar" />   </somepath> </sometask>
The object implemention sometask must provide a method called createSomepath which returns an instance of Path. Nested path definitions are handled by the Path object and must be labeled pathelement.

The path element takes a parameter path which will be parsed and split into single elements. It will usually be used to define a path from an environment variable.

Author:
Thomas.Haas@softwired-inc.com

Field Summary
static Path systemClasspath
           
 
Constructor Summary
Path()
           
Path(java.lang.String path)
           
 
Method Summary
 void append(Path other)
          Append the contents of the other Path instance to this.
 Path createPathElement()
           
 java.lang.String[] list()
          Returns all path elements defined by this and netsed path objects.
 void setLocation(java.lang.String location)
          Adds a element definition to the path.
 void setPath(java.lang.String path)
          Parses a path definition and creates single PathElements.
 java.lang.String toString()
          Returns a textual representation of the path, which can be used as CLASSPATH or PATH environment variable definition.
static java.lang.String translateFile(java.lang.String source)
           
protected static boolean translateFileSep(java.lang.StringBuffer buffer, int pos)
           
static java.util.Vector translatePath(java.lang.String source)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

systemClasspath

public static Path systemClasspath
Constructor Detail

Path

public Path(java.lang.String path)

Path

public Path()
Method Detail

setLocation

public void setLocation(java.lang.String location)
Adds a element definition to the path.
Parameters:
location - the location of the element to add (must not be null nor empty.

append

public void append(Path other)
Append the contents of the other Path instance to this.

setPath

public void setPath(java.lang.String path)
Parses a path definition and creates single PathElements.
Parameters:
path - the path definition.

createPathElement

public Path createPathElement()

list

public java.lang.String[] list()
Returns all path elements defined by this and netsed path objects.
Returns:
list of path elements.

toString

public java.lang.String toString()
Returns a textual representation of the path, which can be used as CLASSPATH or PATH environment variable definition.
Overrides:
toString in class java.lang.Object
Returns:
a textual representation of the path.

translatePath

public static java.util.Vector translatePath(java.lang.String source)

translateFile

public static java.lang.String translateFile(java.lang.String source)

translateFileSep

protected static boolean translateFileSep(java.lang.StringBuffer buffer,
                                          int pos)


Copyright © 2000 Apache Software Foundation. All Rights Reserved.