donaldp 02/03/22 21:02:52
Modified: proposal/myrmidon/src/java/org/apache/antlib/core
PropertyDump.java
Log:
Only dump propertys with a specified prefix
Revision Changes Path
1.4 +27 -2
jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/core/PropertyDump.java
Index: PropertyDump.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/antlib/core/PropertyDump.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PropertyDump.java 23 Mar 2002 03:46:31 -0000 1.3
+++ PropertyDump.java 23 Mar 2002 05:02:52 -0000 1.4
@@ -14,17 +14,34 @@
/**
* This is a simple task used to dump out all the proeprtys in the
* runtime. Useful for debugging behaviour in ant build directives.
- * Could possibly be moved to a new antlib.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jim Cook</a>
- * @version $Revision: 1.3 $ $Date: 2002/03/23 03:46:31 $
+ * @version $Revision: 1.4 $ $Date: 2002/03/23 05:02:52 $
* @ant.task name="property-dump"
+ * @todo Consider moving to new antlib
*/
public class PropertyDump
extends AbstractTask
{
/**
+ * The prefix which the keys must start with if they are
+ * to be dumped.
+ */
+ private String m_prefix;
+
+ /**
+ * Set the prefix which the keys must start with if they are
+ * to be dumped. If not specified then all keys are dumped.
+ *
+ * @param prefix the prefix
+ */
+ public void setPrefix( final String prefix )
+ {
+ m_prefix = prefix;
+ }
+
+ /**
* Printout all the properties in ant runtime.
*/
public void execute()
@@ -35,6 +52,14 @@
{
final String key = (String)iterator.next();
final Object value = properties.get( key );
+
+ //Check to see if property starts with specified prefix
+ //and if it doesn't then skip property
+ if( null != m_prefix && !key.startsWith( m_prefix ) )
+ {
+ continue;
+ }
+
getContext().info( key + "=" + value );
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>