curcuru 02/04/09 13:34:55
Modified: test/java/src/org/apache/qetest FileDatalet.java
Log:
Add convenience method getIntOption()
Revision Changes Path
1.5 +25 -1
xml-xalan/test/java/src/org/apache/qetest/FileDatalet.java
Index: FileDatalet.java
===================================================================
RCS file:
/home/cvs/xml-xalan/test/java/src/org/apache/qetest/FileDatalet.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- FileDatalet.java 2 Apr 2002 23:08:15 -0000 1.4
+++ FileDatalet.java 9 Apr 2002 20:34:54 -0000 1.5
@@ -76,7 +76,7 @@
* handling proper URI/URL's according to the RFCs.
*
* @author [EMAIL PROTECTED]
- * @version $Id: FileDatalet.java,v 1.4 2002/04/02 23:08:15 curcuru Exp $
+ * @version $Id: FileDatalet.java,v 1.5 2002/04/09 20:34:54 curcuru Exp $
*/
public class FileDatalet implements Datalet
{
@@ -184,6 +184,30 @@
/** Accessor method for optional properties; settable. */
public void setOptions(Properties p) { options = p; }
+
+
+ /**
+ * Accessor method for optional properties that are ints.
+ * Convenience method to take care of parse/cast to int.
+ *
+ * @param name of property to try to get
+ * @param defValue value if property not available
+ * @return integer value of property, or the default
+ */
+ public int getIntOption(String name, int defValue)
+ {
+ if (null == options)
+ return defValue;
+
+ try
+ {
+ return Integer.parseInt(options.getProperty(name));
+ }
+ catch (Exception e)
+ {
+ return defValue;
+ }
+ }
/** Description of what this Datalet tests. */
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]