1 16 17 package org.apache.commons.launcher.types; 18 19 import java.io.File ; 20 21 import org.apache.tools.ant.ProjectHelper; 22 import org.apache.tools.ant.types.Commandline; 23 import org.apache.tools.ant.types.DataType; 24 import org.apache.tools.ant.types.Path; 25 26 34 public class ConditionalArgument extends DataType { 35 36 38 41 private String ifCondition = null; 42 43 46 private String unlessCondition = null; 47 48 51 private String [] parts = null; 52 53 55 60 public String getIf() { 61 62 return ProjectHelper.replaceProperties(project, ifCondition, project.getProperties()); 63 64 } 65 66 71 public String [] getParts() { 72 73 String [] list = new String [parts.length]; 74 for (int i = 0; i < parts.length; i++) 75 list[i] = ProjectHelper.replaceProperties(project, parts[i], project.getProperties()); 76 return list; 77 78 } 79 80 85 public String getUnless() { 86 87 return ProjectHelper.replaceProperties(project, unlessCondition, project.getProperties()); 88 89 } 90 91 97 public void setFile(File file) { 98 99 this.parts = new String []{ file.getAbsolutePath() }; 100 101 } 102 103 115 public void setIf(String property) { 116 117 this.ifCondition = property; 118 119 } 120 121 126 public void setLine(String line) { 127 128 parts = Commandline.translateCommandline(line); 129 130 } 131 132 138 public void setPath(Path path) { 139 140 this.parts = new String []{ path.toString() }; 141 142 } 143 144 156 public void setUnless(String property) { 157 158 this.unlessCondition = property; 159 160 } 161 162 167 public void setValue(String value) { 168 169 this.parts = new String []{ value }; 170 171 } 172 173 } 174 | Popular Tags |