Class ClasspathUtils

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

public class ClasspathUtils extends Object
Offers some helper methods on the Path structure in ant.

The basic idea behind this utility class is to use it from inside the different Ant objects (and user defined objects) that need classLoading for their operation. Normally those would have a setClasspathRef() {for the @classpathref} and/or a createClasspath() {for the nested <classpath>} Typically one would have in your Ant Task or DataType


 ClasspathUtils.Delegate cpDelegate;

 public void init() {
     this.cpDelegate = ClasspathUtils.getDelegate(this);
     super.init();
 }

 public void setClasspathRef(Reference r) {
     this.cpDelegate.setClasspathRef(r);
 }

 public Path createClasspath() {
     return this.cpDelegate.createClasspath();
 }

 public void setClassname(String fqcn) {
     this.cpDelegate.setClassname(fqcn);
 }
 

At execution time, when you actually need the classloading you can just:


     Object o = this.cpDelegate.newInstance();
 
Since:
Ant 1.6