[04/11] wicket git commit: WICKET-4008 edge test cases plus breaking property into different types in the grammar
WICKET-4008 edge test cases plus breaking property into different types in the grammar Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/b0f7da85 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/b0f7da85 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/b0f7da85 Branch: refs/heads/WICKET-6318-configurable-property-expression-resolver Commit: b0f7da85e45ea4c798366940ec34cd53528cd549 Parents: 2f302db Author: Pedro Henrique Oliveira dos SantosAuthored: Tue Sep 20 18:51:37 2016 -0300 Committer: Pedro Henrique Oliveira dos Santos Committed: Tue Sep 20 19:33:01 2016 -0300 -- .../core/util/lang/PropertyExpression.java | 1 + .../util/lang/PropertyExpressionParser.java | 60 .../util/lang/PropertyExpressionParserTest.java | 138 --- .../wicket/util/lang/PropertyResolverTest.java | 113 --- 4 files changed, 222 insertions(+), 90 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/b0f7da85/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyExpression.java -- diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyExpression.java b/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyExpression.java index 2021c21..635f95e 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyExpression.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyExpression.java @@ -19,6 +19,7 @@ package org.apache.wicket.core.util.lang; public class PropertyExpression { Property property; + CharSequence index; PropertyExpression next; static class Property http://git-wip-us.apache.org/repos/asf/wicket/blob/b0f7da85/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyExpressionParser.java -- diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyExpressionParser.java b/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyExpressionParser.java index 08fd061..3ecb81e 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyExpressionParser.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyExpressionParser.java @@ -31,11 +31,14 @@ import org.apache.wicket.core.util.lang.PropertyExpression.Property; * index char = char - "]" * * java identifier= java letter , {java letter or digit} - * method sign= "(" , ")" + * property name = java letter or digit , {java letter or digit} + * method sign= "(" , { " " } , ")" * index = "[" , index char , {index char} , "]" ; * - * property = java identifier , [ index | method sign ]; - * property expression= property , { "." , property expression } ; + * bean property = property name, [ index ] + * java property = java identifier , [ index | method sign ] + * map property = index + * property expression= [ bean property | java property | map property ], { "." , property expression } ; * * * @@ -55,12 +58,17 @@ public class PropertyExpressionParser { currentPosition = nextPosition; currentToken = lookaheadToken; - nextPosition += 1; if (nextPosition >= text.length()) + { + lookaheadToken = END_OF_EXPRESSION; + } else + { + lookaheadToken = text.charAt(nextPosition); + } return currentToken; } @@ -71,7 +79,8 @@ public class PropertyExpressionParser { throw new ParserException("No expression was given to be parsed."); } - else if (text.length() == 1) + currentToken = text.charAt(0); + if (text.length() == 1) { lookaheadToken = END_OF_EXPRESSION; } @@ -79,7 +88,6 @@ public class PropertyExpressionParser { lookaheadToken = text.charAt(1); } - currentToken = text.charAt(0); return expression(); } @@ -87,7 +95,14 @@ public class PropertyExpressionParser private PropertyExpression expression() {
wicket git commit: WICKET-4008 edge test cases plus breaking property into different types in the grammar
Repository: wicket Updated Branches: refs/heads/WICKET-4008-property-expression-parser 2f302dbfd -> b0f7da85e WICKET-4008 edge test cases plus breaking property into different types in the grammar Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/b0f7da85 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/b0f7da85 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/b0f7da85 Branch: refs/heads/WICKET-4008-property-expression-parser Commit: b0f7da85e45ea4c798366940ec34cd53528cd549 Parents: 2f302db Author: Pedro Henrique Oliveira dos SantosAuthored: Tue Sep 20 18:51:37 2016 -0300 Committer: Pedro Henrique Oliveira dos Santos Committed: Tue Sep 20 19:33:01 2016 -0300 -- .../core/util/lang/PropertyExpression.java | 1 + .../util/lang/PropertyExpressionParser.java | 60 .../util/lang/PropertyExpressionParserTest.java | 138 --- .../wicket/util/lang/PropertyResolverTest.java | 113 --- 4 files changed, 222 insertions(+), 90 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/b0f7da85/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyExpression.java -- diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyExpression.java b/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyExpression.java index 2021c21..635f95e 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyExpression.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyExpression.java @@ -19,6 +19,7 @@ package org.apache.wicket.core.util.lang; public class PropertyExpression { Property property; + CharSequence index; PropertyExpression next; static class Property http://git-wip-us.apache.org/repos/asf/wicket/blob/b0f7da85/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyExpressionParser.java -- diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyExpressionParser.java b/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyExpressionParser.java index 08fd061..3ecb81e 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyExpressionParser.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyExpressionParser.java @@ -31,11 +31,14 @@ import org.apache.wicket.core.util.lang.PropertyExpression.Property; * index char = char - "]" * * java identifier= java letter , {java letter or digit} - * method sign= "(" , ")" + * property name = java letter or digit , {java letter or digit} + * method sign= "(" , { " " } , ")" * index = "[" , index char , {index char} , "]" ; * - * property = java identifier , [ index | method sign ]; - * property expression= property , { "." , property expression } ; + * bean property = property name, [ index ] + * java property = java identifier , [ index | method sign ] + * map property = index + * property expression= [ bean property | java property | map property ], { "." , property expression } ; * * * @@ -55,12 +58,17 @@ public class PropertyExpressionParser { currentPosition = nextPosition; currentToken = lookaheadToken; - nextPosition += 1; if (nextPosition >= text.length()) + { + lookaheadToken = END_OF_EXPRESSION; + } else + { + lookaheadToken = text.charAt(nextPosition); + } return currentToken; } @@ -71,7 +79,8 @@ public class PropertyExpressionParser { throw new ParserException("No expression was given to be parsed."); } - else if (text.length() == 1) + currentToken = text.charAt(0); + if (text.length() == 1) { lookaheadToken = END_OF_EXPRESSION; } @@ -79,7 +88,6 @@ public class PropertyExpressionParser { lookaheadToken = text.charAt(1); } - currentToken = text.charAt(0); return expression(); } @@ -87,7 +95,14 @@ public