Top Description Fields Constructors Methods
org.apache.tools.ant.taskdefs

public Class WhichResource

extends Task
Class Inheritance
Imports
java.net.URL, org.apache.tools.ant.AntClassLoader, .BuildException, .Project, .Task, org.apache.tools.ant.types.Path, .Reference

Find a class or resource on the supplied classpath, or the system classpath if none is supplied. The named property is set if the item can be found. For example
<whichresource resource="/log4j.properties"
  property="log4j.url" >
Since
Ant 1.6

Field Summary

Modifier and TypeField and Description
private String
classname

class to look for

private Path
classpath

our classpath

private String
property

property to set

private String
resource

resource to look for

Inherited from org.apache.tools.ant.Task:
targettaskNametaskTypewrapper

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Path

Returns:

a classpath to be configured.
createClasspath
()

Adds a path to the classpath.

public void
public void
setClass(String
the name of the class to look for.
classname
)

name the class to look for

public void
setClasspath(Path
the classpath to be used.
cp
)

Set the classpath to be used for this compilation.

public void
setClasspathRef(Reference
a reference to an existing classpath.
r
)

Set the classpath to use by reference.

public void
setProperty(String
the property to be set.
property
)

the property to fill with the URL of the resource or class

public void
setResource(String
the name of the resource to look for.
resource
)

name the resource to look for

private void
validate()

validate

Inherited from org.apache.tools.ant.Task:
bindToOwnergetOwningTargetgetRuntimeConfigurableWrappergetTaskNamegetTaskTypegetWrapperhandleErrorFlushhandleErrorOutputhandleFlushhandleInputhandleOutputinitisInvalidloglogloglogmaybeConfigureperformreconfiguresetOwningTargetsetRuntimeConfigurableWrappersetTaskNamesetTaskType

Field Detail

classnameback to summary
private String classname

class to look for

classpathback to summary
private Path classpath

our classpath

propertyback to summary
private String property

property to set

resourceback to summary
private String resource

resource to look for

Constructor Detail

WhichResourceback to summary
public WhichResource()

Method Detail

createClasspathback to summary
public Path createClasspath()

Adds a path to the classpath.

Returns:Path

a classpath to be configured.

executeback to summary
public void execute() throws BuildException

Overrides org.apache.tools.ant.Task.execute.

execute it

Annotations
@Override
Exceptions
BuildException:
on error
setClassback to summary
public void setClass(String classname)

name the class to look for

Parameters
classname:String

the name of the class to look for.

setClasspathback to summary
public void setClasspath(Path cp)

Set the classpath to be used for this compilation.

Parameters
cp:Path

the classpath to be used.

setClasspathRefback to summary
public void setClasspathRef(Reference r)

Set the classpath to use by reference.

Parameters
r:Reference

a reference to an existing classpath.

Since
Ant 1.7.1
setPropertyback to summary
public void setProperty(String property)

the property to fill with the URL of the resource or class

Parameters
property:String

the property to be set.

setResourceback to summary
public void setResource(String resource)

name the resource to look for

Parameters
resource:String

the name of the resource to look for.

validateback to summary
private void validate()

validate