You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by jv...@locus.apache.org on 2000/11/28 05:16:24 UTC
cvs commit: jakarta-velocity/src/java/org/apache/velocity/runtime/directive Directive.java DirectiveConstants.java Foreach.java Include.java Macro.java Parse.java VelocimacroProxy.java
jvanzyl 00/11/27 20:16:23
Modified: src/java/org/apache/velocity/runtime/directive
Directive.java DirectiveConstants.java Foreach.java
Include.java Macro.java Parse.java
VelocimacroProxy.java
Log:
- revert to using the simple getName()/getType() properties
in each of the directives.
Revision Changes Path
1.9 +2 -52 jakarta-velocity/src/java/org/apache/velocity/runtime/directive/Directive.java
Index: Directive.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/directive/Directive.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Directive.java 2000/11/27 23:57:34 1.8
+++ Directive.java 2000/11/28 04:16:21 1.9
@@ -65,62 +65,12 @@
*/
public abstract class Directive implements DirectiveConstants,Cloneable
{
- /** The name of this directive */
- public String name;
-
- /** The type of this directive: LINE or BLOCK */
- public int type;
-
- /**
- * Name of the directive that will be set
- * via reflection when this directive
- * is initialized in the Runtime. This
- * value must be set in each of the
- * directives.
- */
- public String DIRECTIVE_NAME = "Directive";
-
- /**
- * Type of the directive that will be set
- * via reflection when this directive
- * is initialized in the Runtime. This
- * value must be set in each of the
- * directives.
- */
- public int DIRECTIVE_TYPE = LINE;
-
/** Return the name of this directive */
- public String getName()
- {
- return name;
- }
+ public abstract String getName();
/** Get the directive type BLOCK/LINE */
- public int getType()
- {
- return type;
- }
-
- /**
- * Set the name of this directive. This
- * is done in the Velocity Runtime
- * when the directive is initialized.
- */
- public void setName(String name)
- {
- this.name = name;
- }
+ public abstract int getType();
- /**
- * Set the type of this directive. This
- * is done in the Velocity Runtime
- * when the directive is initialized.
- */
- public void setType(int type)
- {
- this.type = type;
- }
-
/**
* How this directive is to be initialized.
*/
1.2 +0 -16 jakarta-velocity/src/java/org/apache/velocity/runtime/directive/DirectiveConstants.java
Index: DirectiveConstants.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/directive/DirectiveConstants.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DirectiveConstants.java 2000/11/27 23:57:36 1.1
+++ DirectiveConstants.java 2000/11/28 04:16:21 1.2
@@ -65,20 +65,4 @@
/** Line directive indicator */
public static final int LINE = 2;
-
- /**
- * Name of the field that contains the
- * name for this directive. It will be grabbed
- * via reflection and set when the directive
- * is initialized in the Velocity Runtime.
- */
- public static final String NAME_FIELD = "DIRECTIVE_NAME";
-
- /**
- * Type of the field that contains the
- * name for this directive. It will be grabbed
- * via reflection and set when the directive
- * is initialized in the Velocity Runtime.
- */
- public static final String TYPE_FIELD = "DIRECTIVE_TYPE";
}
1.26 +11 -11 jakarta-velocity/src/java/org/apache/velocity/runtime/directive/Foreach.java
Index: Foreach.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/directive/Foreach.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- Foreach.java 2000/11/27 23:57:37 1.25
+++ Foreach.java 2000/11/28 04:16:21 1.26
@@ -85,25 +85,25 @@
*
* @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
* @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
- * @version $Id: Foreach.java,v 1.25 2000/11/27 23:57:37 jvanzyl Exp $
+ * @version $Id: Foreach.java,v 1.26 2000/11/28 04:16:21 jvanzyl Exp $
*/
public class Foreach extends Directive
{
/**
- * Name of this directive. Reflection is used
- * in the Runtime to grab the value of this
- * field so that the directive can be named
- * and initialized.
+ * Return name of this directive.
*/
- public String DIRECTIVE_NAME = "foreach";
+ public String getName()
+ {
+ return "foreach";
+ }
/**
- * Type of this directive. Reflection is used
- * in the Runtime to grab the value of this
- * field so that the directive can be typed
- * and initialized.
+ * Return type of this directive.
*/
- public int DIRECTIVE_TYPE = BLOCK;
+ public int getType()
+ {
+ return BLOCK;
+ }
/**
* Flag to indicate that the list object being used
1.8 +11 -11 jakarta-velocity/src/java/org/apache/velocity/runtime/directive/Include.java
Index: Include.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/directive/Include.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Include.java 2000/11/28 00:38:40 1.7
+++ Include.java 2000/11/28 04:16:21 1.8
@@ -93,25 +93,25 @@
*
* @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
* @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
- * @version $Id: Include.java,v 1.7 2000/11/28 00:38:40 jvanzyl Exp $
+ * @version $Id: Include.java,v 1.8 2000/11/28 04:16:21 jvanzyl Exp $
*/
public class Include extends Directive
{
/**
- * Name of this directive. Reflection is used
- * in the Runtime to grab the value of this
- * field so that the directive can be named
- * and initialized.
+ * Return name of this directive.
*/
- public String DIRECTIVE_NAME = "include";
+ public String getName()
+ {
+ return "include";
+ }
/**
- * Type of this directive. Reflection is used
- * in the Runtime to grab the value of this
- * field so that the directive can be typed
- * and initialized.
+ * Return type of this directive.
*/
- public int DIRECTIVE_TYPE = LINE;
+ public int getType()
+ {
+ return LINE;
+ }
/**
* iterates through the argument list and renders every
1.3 +11 -11 jakarta-velocity/src/java/org/apache/velocity/runtime/directive/Macro.java
Index: Macro.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/directive/Macro.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Macro.java 2000/11/27 23:57:39 1.2
+++ Macro.java 2000/11/28 04:16:22 1.3
@@ -70,7 +70,7 @@
* macro. It is used inline in the parser when processing a directive.
*
* @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
- * @version $Id: Macro.java,v 1.2 2000/11/27 23:57:39 jvanzyl Exp $
+ * @version $Id: Macro.java,v 1.3 2000/11/28 04:16:22 jvanzyl Exp $
*/
package org.apache.velocity.runtime.directive;
@@ -88,20 +88,20 @@
public class Macro extends Directive
{
/**
- * Name of this directive. Reflection is used
- * in the Runtime to grab the value of this
- * field so that the directive can be named
- * and initialized.
+ * Return name of this directive.
*/
- public String DIRECTIVE_NAME = "macro";
+ public String getName()
+ {
+ return "macro";
+ }
/**
- * Type of this directive. Reflection is used
- * in the Runtime to grab the value of this
- * field so that the directive can be typed
- * and initialized.
+ * Return type of this directive.
*/
- public int DIRECTIVE_TYPE = BLOCK;
+ public int getType()
+ {
+ return BLOCK;
+ }
private static boolean bDebug_ = false;
1.7 +11 -11 jakarta-velocity/src/java/org/apache/velocity/runtime/directive/Parse.java
Index: Parse.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/directive/Parse.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Parse.java 2000/11/28 00:38:41 1.6
+++ Parse.java 2000/11/28 04:16:22 1.7
@@ -83,25 +83,25 @@
*
* @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
* @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
- * @version $Id: Parse.java,v 1.6 2000/11/28 00:38:41 jvanzyl Exp $
+ * @version $Id: Parse.java,v 1.7 2000/11/28 04:16:22 jvanzyl Exp $
*/
public class Parse extends Directive
{
/**
- * Name of this directive. Reflection is used
- * in the Runtime to grab the value of this
- * field so that the directive can be named
- * and initialized.
+ * Return name of this directive.
*/
+ public String getName()
+ {
+ return "parse";
+ }
- public String DIRECTIVE_NAME = "parse";
/**
- * Type of this directive. Reflection is used
- * in the Runtime to grab the value of this
- * field so that the directive can be typed
- * and initialized.
+ * Return type of this directive.
*/
- public int DIRECTIVE_TYPE = LINE;
+ public int getType()
+ {
+ return LINE;
+ }
SimpleNode nodeTree_ = null;
int iParseDepth_ = 1;
1.8 +17 -3 jakarta-velocity/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java
Index: VelocimacroProxy.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- VelocimacroProxy.java 2000/11/27 23:57:45 1.7
+++ VelocimacroProxy.java 2000/11/28 04:16:22 1.8
@@ -58,7 +58,7 @@
* a proxy Directive-derived object to fit with the current directive system
*
* @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
- * @version $Id: VelocimacroProxy.java,v 1.7 2000/11/27 23:57:45 jvanzyl Exp $
+ * @version $Id: VelocimacroProxy.java,v 1.8 2000/11/28 04:16:22 jvanzyl Exp $
*/
package org.apache.velocity.runtime.directive;
@@ -91,8 +91,22 @@
private boolean bInit_ = false;
- public String getName() { return strMacroName_; }
- public int getType() { return LINE; }
+ /**
+ * Return name of this Velocimacro.
+ */
+ public String getName()
+ {
+ return strMacroName_;
+ }
+
+ /**
+ * Velocimacros are always LINE
+ * type directives.
+ */
+ public int getType()
+ {
+ return LINE;
+ }
/**
* sets the directive name of this VM