[05/11] wicket git commit: WICKET-4008 parser differentiates java identifiers from bean properties
WICKET-4008 parser differentiates java identifiers from bean properties Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/697052f7 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/697052f7 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/697052f7 Branch: refs/heads/WICKET-6318-configurable-property-expression-resolver Commit: 697052f713345484b93f4ef61163587473b7b202 Parents: b0f7da8 Author: Pedro Henrique Oliveira dos SantosAuthored: Tue Sep 20 22:09:36 2016 -0300 Committer: Pedro Henrique Oliveira dos Santos Committed: Tue Sep 20 22:09:36 2016 -0300 -- .../core/util/lang/PropertyExpression.java | 70 ++--- .../util/lang/PropertyExpressionParser.java | 69 ++-- .../util/lang/PropertyExpressionParserTest.java | 82 +++- .../wicket/util/lang/PropertyResolverTest.java | 10 ++- 4 files changed, 160 insertions(+), 71 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/697052f7/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 635f95e..dab79ec 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 @@ -18,21 +18,76 @@ package org.apache.wicket.core.util.lang; public class PropertyExpression { - Property property; + JavaProperty javaProperty; + BeanProperty beanProperty; CharSequence index; PropertyExpression next; - static class Property + static class BeanProperty + { + CharSequence propertyName; + CharSequence index; + + public BeanProperty() + { + } + + public BeanProperty(String name, String index) + { + this.propertyName = name; + this.index = index; + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = 1; + result = prime * result + ((index == null) ? 0 : index.hashCode()); + result = prime * result + ((propertyName == null) ? 0 : propertyName.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + BeanProperty other = (BeanProperty)obj; + if (index == null) + { + if (other.index != null) + return false; + } + else if (!index.equals(other.index)) + return false; + if (propertyName == null) + { + if (other.propertyName != null) + return false; + } + else if (!propertyName.equals(other.propertyName)) + return false; + return true; + } + + } + + static class JavaProperty { CharSequence javaIdentifier; CharSequence index; public boolean hasMethodSign; - public Property() + public JavaProperty() { } - public Property(String javaIdentifier, String index, boolean hasMethodSign) + public JavaProperty(String javaIdentifier, String index, boolean hasMethodSign) { this.javaIdentifier = javaIdentifier; this.index = index; @@ -59,7 +114,7 @@ public class PropertyExpression return false; if (getClass() != obj.getClass()) return false; - Property other = (Property)obj; + JavaProperty other = (JavaProperty)obj; if (hasMethodSign
wicket git commit: WICKET-4008 parser differentiates java identifiers from bean properties
Repository: wicket Updated Branches: refs/heads/WICKET-4008-property-expression-parser b0f7da85e -> 697052f71 WICKET-4008 parser differentiates java identifiers from bean properties Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/697052f7 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/697052f7 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/697052f7 Branch: refs/heads/WICKET-4008-property-expression-parser Commit: 697052f713345484b93f4ef61163587473b7b202 Parents: b0f7da8 Author: Pedro Henrique Oliveira dos SantosAuthored: Tue Sep 20 22:09:36 2016 -0300 Committer: Pedro Henrique Oliveira dos Santos Committed: Tue Sep 20 22:09:36 2016 -0300 -- .../core/util/lang/PropertyExpression.java | 70 ++--- .../util/lang/PropertyExpressionParser.java | 69 ++-- .../util/lang/PropertyExpressionParserTest.java | 82 +++- .../wicket/util/lang/PropertyResolverTest.java | 10 ++- 4 files changed, 160 insertions(+), 71 deletions(-) -- http://git-wip-us.apache.org/repos/asf/wicket/blob/697052f7/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 635f95e..dab79ec 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 @@ -18,21 +18,76 @@ package org.apache.wicket.core.util.lang; public class PropertyExpression { - Property property; + JavaProperty javaProperty; + BeanProperty beanProperty; CharSequence index; PropertyExpression next; - static class Property + static class BeanProperty + { + CharSequence propertyName; + CharSequence index; + + public BeanProperty() + { + } + + public BeanProperty(String name, String index) + { + this.propertyName = name; + this.index = index; + } + + @Override + public int hashCode() + { + final int prime = 31; + int result = 1; + result = prime * result + ((index == null) ? 0 : index.hashCode()); + result = prime * result + ((propertyName == null) ? 0 : propertyName.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + BeanProperty other = (BeanProperty)obj; + if (index == null) + { + if (other.index != null) + return false; + } + else if (!index.equals(other.index)) + return false; + if (propertyName == null) + { + if (other.propertyName != null) + return false; + } + else if (!propertyName.equals(other.propertyName)) + return false; + return true; + } + + } + + static class JavaProperty { CharSequence javaIdentifier; CharSequence index; public boolean hasMethodSign; - public Property() + public JavaProperty() { } - public Property(String javaIdentifier, String index, boolean hasMethodSign) + public JavaProperty(String javaIdentifier, String index, boolean hasMethodSign) { this.javaIdentifier = javaIdentifier; this.index = index; @@ -59,7 +114,7 @@ public class PropertyExpression return false; if (getClass() != obj.getClass()) return false; - Property other = (Property)obj; +