Methods Summary |
---|
public int | compareTo(java.lang.Object another)Compare this JavaResource to another Resource.
if (isReference()) {
return ((Comparable) getCheckedRef()).compareTo(another);
}
if (another.getClass().equals(getClass())) {
JavaResource otherjr = (JavaResource) another;
if (!getName().equals(otherjr.getName())) {
return getName().compareTo(otherjr.getName());
}
if (loader != otherjr.loader) {
if (loader == null) {
return -1;
}
if (otherjr.loader == null) {
return 1;
}
return loader.getRefId().compareTo(otherjr.loader.getRefId());
}
Path p = getClasspath();
Path op = otherjr.getClasspath();
if (p != op) {
if (p == null) {
return -1;
}
if (op == null) {
return 1;
}
return p.toString().compareTo(op.toString());
}
return 0;
}
return super.compareTo(another);
|
public org.apache.tools.ant.types.Path | createClasspath()Add a classpath to use when looking up a resource.
checkChildrenAllowed();
if (this.classpath == null) {
this.classpath = new Path(getProject());
}
return this.classpath.createPath();
|
public org.apache.tools.ant.types.Path | getClasspath()get the classpath used by this LoadProperties .
return isReference()
? ((JavaResource) getCheckedRef()).getClasspath() : classpath;
|
public java.io.InputStream | getInputStream()Return an InputStream for reading the contents of this Resource.
if (isReference()) {
return ((Resource) getCheckedRef()).getInputStream();
}
ClassLoader cl = null;
if (loader != null) {
cl = (ClassLoader) loader.getReferencedObject();
}
if (cl == null) {
if (getClasspath() != null) {
cl = getProject().createClassLoader(classpath);
} else {
cl = JavaResource.class.getClassLoader();
}
if (loader != null && cl != null) {
getProject().addReference(loader.getRefId(), cl);
}
}
return cl == null ? ClassLoader.getSystemResourceAsStream(getName())
: cl.getResourceAsStream(getName());
|
public boolean | isExists()Learn whether this file exists.
InputStream is = null;
try {
return isReference() ? ((Resource) getCheckedRef()).isExists()
: (is = getInputStream()) != null;
} catch (IOException ex) {
return false;
} finally {
FileUtils.close(is);
}
|
public void | setClasspath(org.apache.tools.ant.types.Path classpath)Set the classpath to use when looking up a resource.
checkAttributesAllowed();
if (this.classpath == null) {
this.classpath = classpath;
} else {
this.classpath.append(classpath);
}
|
public void | setClasspathRef(org.apache.tools.ant.types.Reference r)Set the classpath to use when looking up a resource,
given as reference to a <path> defined elsewhere
checkAttributesAllowed();
createClasspath().setRefid(r);
|
public void | setLoaderRef(org.apache.tools.ant.types.Reference r)Use the reference to locate the loader. If the loader is not
found, taskdef will use the specified classpath and register it
with the specified name.
This allow multiple taskdef/typedef to use the same class loader,
so they can be used together. It eliminate the need to
put them in the CLASSPATH.
checkAttributesAllowed();
loader = r;
|
public void | setRefid(org.apache.tools.ant.types.Reference r)Overrides the super version.
if (loader != null || classpath != null) {
throw tooManyAttributes();
}
super.setRefid(r);
|