This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new 2014a85 DynaBean improvements.
2014a85 is described below
commit 2014a85f63fac4f237a28bd223ba992276637f55
Author: JamesBognar <[email protected]>
AuthorDate: Thu Apr 5 11:02:21 2018 -0400
DynaBean improvements.
---
.../java/org/apache/juneau/DynaBeanComboTest.java | 2 +-
.../src/main/java/org/apache/juneau/BeanMeta.java | 26 +++++++++++++++++++---
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git
a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/DynaBeanComboTest.java
b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/DynaBeanComboTest.java
index 9e70174..6711527 100644
---
a/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/DynaBeanComboTest.java
+++
b/juneau-core/juneau-core-test/src/test/java/org/apache/juneau/DynaBeanComboTest.java
@@ -264,7 +264,7 @@ public class DynaBeanComboTest extends ComboRoundTripTest {
}
@BeanProperty(name="*")
- public void yyy(String name, Object o) {
+ public void setYYY(String name, Object o) {
setterCalled = true;
this.f2.put(name, o);
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
index 1d6c4fe..0cacb9e 100644
--- a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
+++ b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/BeanMeta.java
@@ -617,6 +617,13 @@ public class BeanMeta<T> {
} else if (n.startsWith("is") &&
(rt.equals(Boolean.TYPE) || rt.equals(Boolean.class))) {
methodType = GETTER;
n = n.substring(2);
+ } else if ("*".equals(bpName)) {
+ if
(isParentClass(Collection.class, rt)) {
+ methodType = EXTRAKEYS;
+ } else if
(isParentClass(Map.class, rt)) {
+ methodType = GETTER;
+ }
+ n = bpName;
} else if (bpName != null) {
methodType = GETTER;
if (bpName.isEmpty()) {
@@ -633,6 +640,11 @@ public class BeanMeta<T> {
if (n.startsWith("set") &&
(isParentClass(rt, c) || rt.equals(Void.TYPE))) {
methodType = SETTER;
n = n.substring(3);
+ } else if ("*".equals(bpName)) {
+ if (isParentClass(Map.class,
pt[0])) {
+ methodType = SETTER;
+ n = bpName;
+ }
} else if (bpName != null) {
methodType = SETTER;
if (bpName.isEmpty()) {
@@ -646,13 +658,21 @@ public class BeanMeta<T> {
methodType = SETTER;
}
} else if (pt.length == 2) {
- if ("*".equals(bpName)) {
- methodType = SETTER;
+ if ("*".equals(bpName) && pt[0] ==
String.class) {
+ if (n.startsWith("set") &&
(isParentClass(rt, c) || rt.equals(Void.TYPE))) {
+ methodType = SETTER;
+ } else {
+ methodType = GETTER;
+ }
n = bpName;
}
}
n = pn.getPropertyName(n);
- if (methodType == GETTER || methodType ==
SETTER) {
+
+ if ("*".equals(bpName) && methodType == UNKNOWN)
+ throw new BeanRuntimeException(c,
"Found @BeanProperty(\"*\") but could not determine method type.", bpName);
+
+ if (methodType != UNKNOWN) {
if (bpName != null && !
bpName.isEmpty()) {
n = bpName;
if (! fixedBeanProps.isEmpty())
--
To stop receiving notification emails like this one, please contact
[email protected].