Package org.apache.tools.ant.types
Class Reference
- java.lang.Object
- 
- org.apache.tools.ant.types.Reference
 
- 
- Direct Known Subclasses:
- Ant.Reference
 
 public class Reference extends java.lang.ObjectClass to hold a reference to another object in the project.
- 
- 
Method SummaryModifier and Type Method Description ProjectgetProject()Get the associated project, if any; may be null.<T> TgetReferencedObject()Resolve the reference, looking in the associated project.<T> TgetReferencedObject(Project fallback)Resolve the reference, using the associated project if it set, otherwise use the passed in project.java.lang.StringgetRefId()Get the reference id of this reference.voidsetProject(Project p)Set the associated project.voidsetRefId(java.lang.String id)Set the reference id.
 
- 
- 
- 
Constructor Detail- 
Reference@Deprecated public Reference() Deprecated.since 1.7. Please useReference(Project,String)instead.Create a reference.
 - 
Reference@Deprecated public Reference(java.lang.String id) Deprecated.since 1.7. Please useReference(Project,String)instead.Create a reference to a named ID.- Parameters:
- id- the name of this reference
 
 - 
Referencepublic Reference(Project p, java.lang.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- 
setRefIdpublic void setRefId(java.lang.String id) Set the reference id. Should not normally be necessary; useReference(Project, String).- Parameters:
- id- the reference id to use
 
 - 
getRefIdpublic java.lang.String getRefId() Get the reference id of this reference.- Returns:
- the reference id
 
 - 
setProjectpublic void setProject(Project p) Set the associated project. Should not normally be necessary; useReference(Project,String).- Parameters:
- p- the project to use
- Since:
- Ant 1.6.3
 
 - 
getProjectpublic Project getProject() Get the associated project, if any; may be null.- Returns:
- the associated project
- Since:
- Ant 1.6.3
 
 - 
getReferencedObjectpublic <T> T getReferencedObject(Project fallback) throws BuildException Resolve the reference, using the associated project if it set, otherwise use the passed in project.- Type Parameters:
- T- desired object type
- 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.
 
 - 
getReferencedObjectpublic <T> T getReferencedObject() throws BuildExceptionResolve the reference, looking in the associated project.- Type Parameters:
- T- desired object type
- 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.getReference(java.lang.String)
 
 
- 
 
-