Browse Source

add a new constructor for programmatic construction of a StringResource with property substitution (will support fixing broken Concat tests)

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@536355 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 18 years ago
parent
commit
6b652facf6
1 changed files with 13 additions and 1 deletions
  1. +13
    -1
      src/main/org/apache/tools/ant/types/resources/StringResource.java

+ 13
- 1
src/main/org/apache/tools/ant/types/resources/StringResource.java View File

@@ -26,6 +26,7 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;


import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.Resource; import org.apache.tools.ant.types.Resource;
import org.apache.tools.ant.types.Reference; import org.apache.tools.ant.types.Reference;


@@ -52,7 +53,18 @@ public class StringResource extends Resource {
* @param value the value of this StringResource. * @param value the value of this StringResource.
*/ */
public StringResource(String value) { public StringResource(String value) {
setValue(value);
this(null, value);
}

/**
* Construct a StringResource with the supplied project and value,
* doing property replacement against the project if non-null.
* @param project the owning Project.
* @param value the value of this StringResource.
*/
public StringResource(Project project, String value) {
setProject(project);
setValue(project == null ? value : project.replaceProperties(value));
} }


/** /**


Loading…
Cancel
Save