Reference (Apache Ant API)
Keywords: org.apache.tools.ant.types.Reference class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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.Object

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

Constructor Summary
`Reference()` Deprecated. since 1.7. Please use `Reference(Project,String)` instead.
`Reference(Project p, java.lang.String id)` Create a reference to a named ID in a particular project.
`Reference(java.lang.String id)` Deprecated. since 1.7. Please use `Reference(Project,String)` instead.

Method Summary
`Project` | `getProject()` Get the associated project, if any; may be null.
`java.lang.Object` | `getReferencedObject()` Resolve the reference, looking in the associated project.
`java.lang.Object` | `getReferencedObject(Project fallback)` Resolve the reference, using the associated project if it set, otherwise use the passed in project.
`java.lang.String` | `getRefId()` Get the reference id of this reference.
`void` | `setProject(Project p)` Set the associated project.
`void` | `setRefId(java.lang.String id)` Set the reference id.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Reference

    public Reference()

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

  Create a reference.

### Reference

    public Reference(java.lang.String id)

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

  Create a reference to a named ID.

  Parameters:
    `id` - the name of this reference

### Reference

    public 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

### setRefId

    public void setRefId(java.lang.String id)

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

  Parameters:
    `id` - the reference id to use

### getRefId

    public java.lang.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 `Reference(Project,String)`.

  Parameters:
    `p` - the project to use
  Since:
    Ant 1.6.3

### getProject

    public Project getProject()

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

  Returns:
    the associated project
  Since:
    Ant 1.6.3

### getReferencedObject

    public java.lang.Object getReferencedObject(Project fallback)
                                         throws BuildException

  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 java.lang.Object getReferencedObject()
                                         throws BuildException

  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.getReference(java.lang.String)`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD