git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1553417 13f79535-47bb-0310-9956-ffa450edef68master
@@ -17,6 +17,9 @@ | |||||
*/ | */ | ||||
package org.apache.tools.ant.types.resources; | package org.apache.tools.ant.types.resources; | ||||
import java.io.File; | |||||
import java.util.Iterator; | |||||
import org.apache.tools.ant.types.Reference; | import org.apache.tools.ant.types.Reference; | ||||
import org.apache.tools.ant.types.Resource; | import org.apache.tools.ant.types.Resource; | ||||
import org.apache.tools.ant.util.FileNameMapper; | import org.apache.tools.ant.util.FileNameMapper; | ||||
@@ -99,4 +102,12 @@ public class MappedResource extends ResourceDecorator { | |||||
return (myName == null ? otherName == null : myName.equals(otherName)) | return (myName == null ? otherName == null : myName.equals(otherName)) | ||||
&& getResource().equals(m.getResource()); | && getResource().equals(m.getResource()); | ||||
} | } | ||||
public String toString() { | |||||
if (isReference()) { | |||||
return getCheckedRef().toString(); | |||||
} | |||||
return getName(); | |||||
} | |||||
} | } |
@@ -17,6 +17,7 @@ | |||||
*/ | */ | ||||
package org.apache.tools.ant.types.resources; | package org.apache.tools.ant.types.resources; | ||||
import java.io.File; | |||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Collection; | import java.util.Collection; | ||||
import java.util.Iterator; | import java.util.Iterator; | ||||
@@ -239,4 +240,27 @@ public class MappedResourceCollection | |||||
} | } | ||||
return collected; | return collected; | ||||
} | } | ||||
/** | |||||
* Format this resource collection as a String. | |||||
* @return a descriptive <code>String</code>. | |||||
*/ | |||||
public String toString() { | |||||
if (isReference()) { | |||||
return getCheckedRef().toString(); | |||||
} | |||||
Iterator<Resource> i = iterator(); | |||||
if (!i.hasNext()) { | |||||
return ""; | |||||
} | |||||
StringBuffer sb = new StringBuffer(); | |||||
while (i.hasNext()) { | |||||
if (sb.length() > 0) { | |||||
sb.append(File.pathSeparatorChar); | |||||
} | |||||
sb.append(i.next()); | |||||
} | |||||
return sb.toString(); | |||||
} | |||||
} | } |