jvanzyl 2004/01/06 10:18:33
Modified: src/java/org/apache/maven/jelly/tags/maven PropertyTag.java
Log:
o allow the option of specifying the name the property should be retrieved
with in the MavenJellyContext.
Revision Changes Path
1.2 +14 -2
maven/src/java/org/apache/maven/jelly/tags/maven/PropertyTag.java
Index: PropertyTag.java
===================================================================
RCS file:
/home/cvs/maven/src/java/org/apache/maven/jelly/tags/maven/PropertyTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PropertyTag.java 6 Jan 2004 18:09:14 -0000 1.1
+++ PropertyTag.java 6 Jan 2004 18:18:33 -0000 1.2
@@ -68,7 +68,8 @@
/**
* A Maven Jelly tag that attempts to retrieve a property from the MavenJellyContext
* context and uses the provided default value in the event there is no valid value
- * retrieved using the key name provided.
+ * retrieved using the key name provided. You may also optionally provide the name
+ * you would like to give the resultant property in the MavenJellyContext.
*
* Usage:
*
@@ -84,6 +85,8 @@
private String defaultValue;
+ private String var;
+
public void setName( String name )
{
this.name = name;
@@ -108,7 +111,16 @@
if ( property == null || property.trim().length() == 0 )
{
- getMavenContext().setVariable( name, defaultValue );
+ property = defaultValue;
+ }
+
+ if ( var != null )
+ {
+ getMavenContext().setVariable( var, property );
+ }
+ else
+ {
+ getMavenContext().setVariable( name, property );
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]