Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 18 19 package org.apache.tools.ant.types; 20 21 import org.apache.tools.ant.BuildException; 22 import org.apache.tools.ant.Project; 23 24 28 public class Reference { 29 30 private String refid; 31 private Project project; 32 33 39 public Reference() { 40 } 41 42 49 public Reference(String id) { 50 setRefId(id); 51 } 52 53 59 public Reference(Project p, String id) { 60 setRefId(id); 61 setProject(p); 62 } 63 64 69 public void setRefId(String id) { 70 refid = id; 71 } 72 73 77 public String getRefId() { 78 return refid; 79 } 80 81 87 public void setProject(Project p) { 88 this.project = p; 89 } 90 91 96 public Project getProject() { 97 return project; 98 } 99 100 108 public Object getReferencedObject(Project fallback) throws BuildException { 109 if (refid == null) { 110 throw new BuildException("No reference specified"); 111 } 112 113 Object o = project == null ? fallback.getReference(refid) : project.getReference(refid); 114 if (o == null) { 115 throw new BuildException("Reference " + refid + " not found."); 116 } 117 return o; 118 } 119 120 127 public Object getReferencedObject() throws BuildException { 128 if (project == null) { 129 throw new BuildException("No project set on reference to " + refid); 130 } 131 return getReferencedObject(project); 132 } 133 134 } 135
| Popular Tags
|