cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [cxf] branch master updated: [CXF-7678] Fluent setters support in search extension (#391)
Date Thu, 15 Mar 2018 01:37:25 GMT
This is an automated email from the ASF dual-hosted git repository.

reta pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new dfcabbd  [CXF-7678] Fluent setters support in search extension (#391)
dfcabbd is described below

commit dfcabbd6322305b4f5696b43b5173f7f70389d2c
Author: ScheRas <scheras@users.noreply.github.com>
AuthorDate: Thu Mar 15 02:37:22 2018 +0100

    [CXF-7678] Fluent setters support in search extension (#391)
---
 .../main/java/org/apache/cxf/jaxrs/ext/search/Beanspector.java   | 5 +++--
 .../java/org/apache/cxf/jaxrs/ext/search/BeanspectorTest.java    | 9 +++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/Beanspector.java
b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/Beanspector.java
index 3a5bbb0..87723fb 100644
--- a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/Beanspector.java
+++ b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/Beanspector.java
@@ -210,8 +210,9 @@ public class Beanspector<T> {
     }
 
     private boolean isSetter(Method m) {
-        return m.getReturnType().equals(void.class) && m.getParameterTypes().length
== 1
-               && (m.getName().startsWith("set") || m.getName().startsWith("is"));
+        return (m.getReturnType().equals(void.class) || m.getReturnType().equals(m.getDeclaringClass()))
+                && m.getParameterTypes().length == 1
+                && (m.getName().startsWith("set") || m.getName().startsWith("is"));
     }
 
 
diff --git a/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/BeanspectorTest.java
b/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/BeanspectorTest.java
index 4204413..6ccc2e1 100644
--- a/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/BeanspectorTest.java
+++ b/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/BeanspectorTest.java
@@ -37,8 +37,9 @@ public class BeanspectorTest extends Assert {
         assertTrue(getters.contains("promised"));
 
         Set<String> setters = bean.getSettersNames();
-        assertEquals(1, setters.size());
-        assertTrue(getters.contains("a"));
+        assertEquals(2, setters.size());
+        assertTrue(setters.contains("a"));
+        assertTrue(setters.contains("fluent"));
     }
 
     @Test(expected = IllegalArgumentException.class)
@@ -69,5 +70,9 @@ public class BeanspectorTest extends Assert {
 
         public void setA(String val) {
         }
+        
+        public SimpleBean setFluent(String val) {
+            return this;
+        }
     }
 }

-- 
To stop receiving notification emails like this one, please contact
reta@apache.org.

Mime
View raw message