1 18 19 package org.apache.tools.ant; 20 21 22 27 public abstract class ProjectComponent implements Cloneable { 28 29 37 protected Project project; 38 39 45 protected Location location = Location.UNKNOWN_LOCATION; 46 47 52 protected String description; 53 55 56 public ProjectComponent() { 57 } 58 59 68 public void setProject(Project project) { 69 this.project = project; 70 } 71 72 77 public Project getProject() { 78 return project; 79 } 80 81 90 public Location getLocation() { 91 return location; 92 } 93 94 103 public void setLocation(Location location) { 104 this.location = location; 105 } 106 107 116 public void setDescription(String desc) { 117 description = desc; 118 } 119 120 126 public String getDescription() { 127 return description; 128 } 129 130 135 public void log(String msg) { 136 log(msg, Project.MSG_INFO); 137 } 138 139 146 public void log(String msg, int msgLevel) { 147 if (getProject() != null) { 148 getProject().log(msg, msgLevel); 149 } else { 150 if (msgLevel <= Project.MSG_INFO) { 154 System.err.println(msg); 155 } 156 } 157 } 158 164 public Object clone() throws CloneNotSupportedException { 165 ProjectComponent pc = (ProjectComponent) super.clone(); 166 pc.setLocation(getLocation()); 167 pc.setProject(getProject()); 168 return pc; 169 } 170 } 171
| Popular Tags
|