geirm 01/01/02 21:26:27
Modified: src/java/org/apache/velocity/runtime/parser/node
ASTMethod.java ASTModNode.java ASTMulNode.java
Log:
No functional change. New context support in AST.
Revision Changes Path
1.10 +6 -7
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
Index: ASTMethod.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTMethod.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ASTMethod.java 2000/12/12 23:46:07 1.9
+++ ASTMethod.java 2001/01/03 05:26:27 1.10
@@ -68,7 +68,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- * @version $Id: ASTMethod.java,v 1.9 2000/12/12 23:46:07 geirm Exp $
+ * @version $Id: ASTMethod.java,v 1.10 2001/01/03 05:26:27 geirm Exp $
*/
package org.apache.velocity.runtime.parser.node;
@@ -77,11 +77,10 @@
import java.io.*;
-import org.apache.velocity.Context;
+import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.runtime.Runtime;
import org.apache.velocity.runtime.parser.*;
import org.apache.velocity.util.introspection.Introspector;
-
import org.apache.velocity.util.introspection.IntrospectionCacheData;
public class ASTMethod extends SimpleNode
@@ -110,7 +109,7 @@
* simple init - init our subtree and get what we can from
* the AST
*/
- public Object init( Context context, Object data)
+ public Object init( InternalContextAdapter context, Object data)
throws Exception
{
super.init( context, data );
@@ -131,7 +130,7 @@
* Note, as this calls value() on the args if any, this must
* only be called at execute() / render() time
*/
- private Method doIntrospection(Context context, Class data)
+ private Method doIntrospection( InternalContextAdapter context, Class data)
throws Exception
{
/*
@@ -153,7 +152,7 @@
* actual return if the method returns something, or
* an empty string "" if the method returns void
*/
- public Object execute(Object o, Context context)
+ public Object execute(Object o, InternalContextAdapter context)
{
/*
* new strategy (strategery!) for introspection. Since we want to be
thread- as well as
@@ -169,7 +168,7 @@
* check the cache
*/
- IntrospectionCacheData icd = context.icacheGet( this );
+ IntrospectionCacheData icd = context.icacheGet( this );
Class c = o.getClass();
/*
1.3 +3 -3
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTModNode.java
Index: ASTModNode.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTModNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ASTModNode.java 2000/12/27 14:31:53 1.2
+++ ASTModNode.java 2001/01/03 05:26:27 1.3
@@ -62,12 +62,12 @@
* what controls the generation of this class.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- * @version $Id: ASTModNode.java,v 1.2 2000/12/27 14:31:53 geirm Exp $
+ * @version $Id: ASTModNode.java,v 1.3 2001/01/03 05:26:27 geirm Exp $
*/
package org.apache.velocity.runtime.parser.node;
-import org.apache.velocity.Context;
+import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.runtime.Runtime;
import org.apache.velocity.runtime.parser.Parser;
@@ -89,7 +89,7 @@
return visitor.visit(this, data);
}
- public Object value(Context context)
+ public Object value( InternalContextAdapter context)
{
/*
* get the two args
1.3 +5 -4
jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTMulNode.java
Index: ASTMulNode.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTMulNode.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ASTMulNode.java 2000/12/27 14:31:53 1.2
+++ ASTMulNode.java 2001/01/03 05:26:27 1.3
@@ -62,12 +62,12 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Geir Magnusson Jr.</a>
- * @version $Id: ASTMulNode.java,v 1.2 2000/12/27 14:31:53 geirm Exp $
+ * @version $Id: ASTMulNode.java,v 1.3 2001/01/03 05:26:27 geirm Exp $
*/
package org.apache.velocity.runtime.parser.node;
-import org.apache.velocity.Context;
+import org.apache.velocity.context.InternalContextAdapter;
import org.apache.velocity.runtime.Runtime;
import org.apache.velocity.runtime.parser.Parser;
@@ -93,7 +93,7 @@
* computes the product of the two args. Returns null if either arg is null
* or if either arg is not an integer
*/
- public Object value( Context context )
+ public Object value( InternalContextAdapter context )
{
/*
* get the two args
@@ -124,7 +124,7 @@
Runtime.error( ( !( left instanceof Integer ) ? "Left" : "Right" )
+ " side of multiplication operation is not a valid
type. "
+ "Currently only integers (1,2,3...) and Integer type
is supported. "
- + context.getCurrentTemplateName() + " [line " +
getLine()
+ + context.getCurrentTemplateName() + " [line " +
getLine()
+ ", column " + getColumn() + "]");
return null;
@@ -133,6 +133,7 @@
return new Integer( ( (Integer) left ).intValue() * ( (Integer) right
).intValue() );
}
}
+