geirm 01/01/13 08:51:59
Modified: src/java/org/apache/velocity/test/provider TestProvider.java
Log:
Added two stateful routines bang() and setBangStart() to mimic a stateful
object/tool passed into a VM.
Revision Changes Path
1.11 +39 -2
jakarta-velocity/src/java/org/apache/velocity/test/provider/TestProvider.java
Index: TestProvider.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/test/provider/TestProvider.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- TestProvider.java 2001/01/06 22:07:40 1.10
+++ TestProvider.java 2001/01/13 16:51:59 1.11
@@ -62,13 +62,15 @@
* is traversed and dynamic content generated.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
- * @version $Id: TestProvider.java,v 1.10 2001/01/06 22:07:40 jvanzyl Exp $
+ * @version $Id: TestProvider.java,v 1.11 2001/01/13 16:51:59 geirm Exp $
*/
public class TestProvider
{
String title = "lunatic";
boolean state;
-
+
+ int stateint = 0;
+
public String getName()
{
return "jason";
@@ -294,6 +296,39 @@
return true;
}
+ /*
+ * This can't have the signature
+
+ public void setState(boolean state)
+
+ or dynamically invoking the method
+ doesn't work ... you would have to
+ put a wrapper around a method for a
+ real boolean property that takes a
+ Boolean object if you wanted this to
+ work. Not really sure how useful it
+ is anyway. Who cares about boolean
+ values you can just set a variable.
+
+ */
+
+ public void setState(Boolean state)
+ {
+ }
+
+ public void setBangStart( Integer i )
+ {
+ System.out.println("SetBangStart() : called with val = " + i );
+ stateint = i.intValue();
+ }
+ public Integer bang()
+ {
+ System.out.println("Bang! : " + stateint );
+ Integer ret = new Integer( stateint );
+ stateint++;
+ return ret;
+ }
+
/**
* Test the ability of vel to use a get(key)
* method for any object type, not just one
@@ -303,4 +338,6 @@
{
return key;
}
+
}
+