You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by di...@apache.org on 2006/04/30 05:14:02 UTC
svn commit: r398272 - in
/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser:
ASTOrNode.java ASTReference.java
Author: dion
Date: Sat Apr 29 20:14:01 2006
New Revision: 398272
URL: http://svn.apache.org/viewcvs?rev=398272&view=rev
Log:
Checkstyle
Modified:
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTOrNode.java
jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTReference.java
Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTOrNode.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTOrNode.java?rev=398272&r1=398271&r2=398272&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTOrNode.java (original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTOrNode.java Sat Apr 29 20:14:01 2006
@@ -25,19 +25,31 @@
* @version $Id$
*/
public class ASTOrNode extends SimpleNode {
+ /**
+ * Create the node given an id.
+ *
+ * @param id node id.
+ */
public ASTOrNode(int id) {
super(id);
}
+ /**
+ * Create a node with the given parser and id.
+ *
+ * @param p a parser.
+ * @param id node id.
+ */
public ASTOrNode(Parser p, int id) {
super(p, id);
}
- /** Accept the visitor. * */
+ /** {@inheritDoc} */
public Object jjtAccept(ParserVisitor visitor, Object data) {
return visitor.visit(this, data);
}
+ /** {@inheritDoc} */
public Object value(JexlContext jc) throws Exception {
Object left = ((SimpleNode) jjtGetChild(0)).value(jc);
boolean leftValue = Coercion.coerceBoolean(left).booleanValue();
Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTReference.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTReference.java?rev=398272&r1=398271&r2=398272&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTReference.java (original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTReference.java Sat Apr 29 20:14:01 2006
@@ -24,29 +24,54 @@
* @version $Id$
*/
public class ASTReference extends SimpleNode {
- SimpleNode root;
+ /** first variable in the expression. */
+ protected SimpleNode root;
+ /**
+ * Create the node given an id.
+ *
+ * @param id node id.
+ */
public ASTReference(int id) {
super(id);
}
+ /**
+ * Create a node with the given parser and id.
+ *
+ * @param p a parser.
+ * @param id node id.
+ */
public ASTReference(Parser p, int id) {
super(p, id);
}
- /** Accept the visitor. * */
+ /** {@inheritDoc} */
public Object jjtAccept(ParserVisitor visitor, Object data) {
return visitor.visit(this, data);
}
+ /** {@inheritDoc} */
public Object value(JexlContext jc) throws Exception {
return execute(null, jc);
}
+ /** Store the first child as {@link ASTReference#root root}. */
public void jjtClose() {
root = (SimpleNode) jjtGetChild(0);
}
+ /**
+ * evaluate each piece of the reference.
+ *
+ * e.g. foo.bar.woogie[2].name, foo is our 'root', and we need to
+ * evaluate 'bar.woogie[2].name' relative to foo.
+ *
+ * @param jc the {@link JexlContext} to evaluate against.
+ * @param obj not used. root.value(jc) is used instead.
+ * @return the value of the array expression.
+ * @throws Exception on any error
+ */
public Object execute(Object obj, JexlContext jc) throws Exception {
Object o = root.value(jc);
@@ -89,6 +114,13 @@
return varName.toString();
}
+ /**
+ * Gets the variable name of {@link ASTReference#root root}.
+ * @return the identifier.
+ * @throws Exception on any error
+ * @see ASTIdentifier#getIdentifierString()
+ * @see ASTArrayAccess#getIdentifierString()
+ */
public String getRootString() throws Exception {
if (root instanceof ASTIdentifier) {
return ((ASTIdentifier) root).getIdentifierString();
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org