org.apache.tools.ant.types

Class Reference

public class Reference extends Object

Class to hold a reference to another object in the project.
Constructor Summary
Reference()
Create a reference.
Reference(String id)
Create a reference to a named ID.
Reference(Project p, String id)
Create a reference to a named ID in a particular project.
Method Summary
ProjectgetProject()
Get the associated project, if any; may be null.
ObjectgetReferencedObject(Project fallback)
Resolve the reference, using the associated project if it set, otherwise use the passed in project.
ObjectgetReferencedObject()
Resolve the reference, looking in the associated project.
StringgetRefId()
Get the reference id of this reference.
voidsetProject(Project p)
Set the associated project.
voidsetRefId(String id)
Set the reference id.

Constructor Detail

Reference

public Reference()

Deprecated: Please use {@link Reference#Reference(Project,String)} instead.

Create a reference.

Reference

public Reference(String id)

Deprecated: Please use {@link Reference#Reference(Project,String)} instead.

Create a reference to a named ID.

Parameters: id the name of this reference

Reference

public Reference(Project p, String id)
Create a reference to a named ID in a particular project.

Parameters: p the project this reference is associated with id the name of this reference

Since: Ant 1.6.3

Method Detail

getProject

public Project getProject()
Get the associated project, if any; may be null.

Returns: the associated project

Since: Ant 1.6.3

getReferencedObject

public Object getReferencedObject(Project fallback)
Resolve the reference, using the associated project if it set, otherwise use the passed in project.

Parameters: fallback the fallback project to use if the project attribute of reference is not set.

Returns: the dereferenced object.

Throws: BuildException if the reference cannot be dereferenced.

getReferencedObject

public Object getReferencedObject()
Resolve the reference, looking in the associated project.

Returns: the dereferenced object.

Throws: BuildException if the project is null or the reference cannot be dereferenced

Since: Ant 1.6.3

See Also: Project

getRefId

public String getRefId()
Get the reference id of this reference.

Returns: the reference id

setProject

public void setProject(Project p)
Set the associated project. Should not normally be necessary; use {@link Reference#Reference(Project,String)}.

Parameters: p the project to use

Since: Ant 1.6.3

setRefId

public void setRefId(String id)
Set the reference id. Should not normally be necessary; use {@link Reference#Reference(Project, String)}.

Parameters: id the reference id to use

Copyright