From 09a7def3cd210a903db5fa8969a5292b93cb8192 Mon Sep 17 00:00:00 2001
From: Stefan Bodewig
Date: Thu, 18 Oct 2001 10:16:18 +0000
Subject: [PATCH] Make 's default attribute work as expected.
PR: 3955
Submitted by: Erik Hatcher
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269802 13f79535-47bb-0310-9956-ffa450edef68
---
docs/manual/OptionalTasks/propertyfile.html | 36 +++++---
.../taskdefs/{ => optional}/propertyfile.xml | 3 +
.../ant/taskdefs/optional/PropertyFile.java | 89 ++++++++++---------
.../taskdefs/optional/PropertyFileTest.java | 46 +++++++---
4 files changed, 108 insertions(+), 66 deletions(-)
rename src/etc/testcases/taskdefs/{ => optional}/propertyfile.xml (79%)
diff --git a/docs/manual/OptionalTasks/propertyfile.html b/docs/manual/OptionalTasks/propertyfile.html
index 786f37fb0..73290199e 100644
--- a/docs/manual/OptionalTasks/propertyfile.html
+++ b/docs/manual/OptionalTasks/propertyfile.html
@@ -56,7 +56,7 @@ are lost. Work is being done to make this task a bit more "human friendly&
Parameters specified as nested elements
Use nested <entry>
-elements to specify actual modifcations to the property file itself
+elements to specify actual modifcations to the property file itself.
Attribute |
@@ -71,8 +71,14 @@ elements to specify actual modifcations to the property file itself
value |
Value to set (=), to add (+) or subtract (-) |
- Yes |
+ At least one must be specified |
+
+ default |
+ Initial value to set for a property if it is not
+ already defined in the property file.
+ For type date, two additional keywords are allowed: "now" or "never". |
+
type |
Regard the value as : int, date or string (default) |
@@ -84,13 +90,6 @@ elements to specify actual modifcations to the property file itself
No |
-
- default |
- Initial value to set for a property if it is not
- already defined in the property file.
- For type date, two additional keywords are allowed: "now" or "never". |
- No |
-
pattern |
For int and date type only. If present, Values will
@@ -98,6 +97,23 @@ elements to specify actual modifcations to the property file itself
| No |
+The rules used when setting a property value are shown below. The
+operation occurs after these rules are considered.
+
+
+ - If only value is specified, the property is set to it regardless of its
+ previous value.
+ - If only default is specified and the property previously existed in the
+ property file, it is unchanged.
+ - If only default is specified and the property did not exist in the
+ property file, the property is set to default.
+ - If value and default are both specified and the property previously
+ existed in the property file, the property is set to value.
+ - If value and default are both specified and the property did not exist in
+ the property file, the property is set to default.
+
+
+
Examples
The following changes the my.properties file. Assume my.properties look like:
@@ -153,4 +169,4 @@ Concatenation of strings :
Each time called, a "." will be appended to "progress"