/**
  * returns reference to object in references container of project
  *
  * @param Project $project
  *
  * @throws BuildException
  *
  * @return Reference
  */
 public function getReferencedObject(Project $project)
 {
     if ($this->refid === null) {
         throw new BuildException("No reference specified");
     }
     $refs = $project->getReferences();
     $o = @$refs[$this->refid];
     if (!is_object($o)) {
         throw new BuildException("Reference {$this->refid} not found.");
     }
     return $o;
 }