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

public Class Reference

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.tools.ant.taskdefs.Ant.Reference
Imports
org.apache.tools.ant.BuildException, .Project

Class to hold a reference to another object in the project.

Field Summary

Modifier and TypeField and Description
private Project
private String

Constructor Summary

AccessConstructor and Description
public
Reference()

Deprecated since 1.7. Please use Reference#Reference(Project, String) instead.
Create a reference.
public
Reference(String
the name of this reference
id
)

Deprecated since 1.7. Please use Reference#Reference(Project, String) instead.
Create a reference to a named ID.
public
Reference(Project
the project this reference is associated with
p
,
String
the name of this reference
id
)

Create a reference to a named ID in a particular project.

Method Summary

Modifier and TypeMethod and Description
public Project

Returns:

the associated project
getProject
()

Get the associated project, if any; may be null.

public <
desired object type
T
>
T

Returns:

the dereferenced object.
getReferencedObject
(Project
the fallback project to use if the project attribute of reference is not set.
fallback
)

Resolve the reference, using the associated project if it set, otherwise use the passed in project.

public <
desired object type
T
>
T

Returns:

the dereferenced object.
getReferencedObject
()

Resolve the reference, looking in the associated project.

public String

Returns:

the reference id
getRefId
()

Get the reference id of this reference.

public void
setProject(Project
the project to use
p
)

Set the associated project.

public void
setRefId(String
the reference id to use
id
)

Set the reference id. Should not normally be necessary; use Reference#Reference(Project, String).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

projectback to summary
private Project project
refidback to summary
private String refid

Constructor Detail

Referenceback to summary
public Reference()

Deprecated

since 1.7. Please use Reference#Reference(Project, String) instead.

Create a reference.

Annotations
@Deprecated
Referenceback to summary
public Reference(String id)

Deprecated

since 1.7. Please use Reference#Reference(Project, String) instead.

Create a reference to a named ID.

Parameters
id:String

the name of this reference

Annotations
@Deprecated
Referenceback to summary
public Reference(Project p, String id)

Create a reference to a named ID in a particular project.

Parameters
p:Project

the project this reference is associated with

id:String

the name of this reference

Since
Ant 1.6.3

Method Detail

getProjectback to summary
public Project getProject()

Get the associated project, if any; may be null.

Returns:Project

the associated project

Since
Ant 1.6.3
getReferencedObjectback to summary
public <T> T getReferencedObject(Project fallback) throws BuildException

Resolve the reference, using the associated project if it set, otherwise use the passed in project.

Parameters
<T>
desired object type
fallback:Project

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

Returns:T

the dereferenced object.

Exceptions
BuildException:
if the reference cannot be dereferenced.
getReferencedObjectback to summary
public <T> T getReferencedObject() throws BuildException

Resolve the reference, looking in the associated project.

Parameters
<T>
desired object type
Returns:T

the dereferenced object.

Exceptions
BuildException:
if the project is null or the reference cannot be dereferenced
Since
Ant 1.6.3
See Also
Project#getReference
getRefIdback to summary
public String getRefId()

Get the reference id of this reference.

Returns:String

the reference id

setProjectback to summary
public void setProject(Project p)

Set the associated project. Should not normally be necessary; use Reference#Reference(Project, String).

Parameters
p:Project

the project to use

Since
Ant 1.6.3
setRefIdback to summary
public void setRefId(String id)

Set the reference id. Should not normally be necessary; use Reference#Reference(Project, String).

Parameters
id:String

the reference id to use