cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1438444 - in /cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src: main/java/org/apache/cxf/jaxb/Utils.java test/java/org/apache/cxf/jaxb/UtilsTest.java
Date Fri, 25 Jan 2013 10:53:31 GMT
Author: ema
Date: Fri Jan 25 10:53:31 2013
New Revision: 1438444

URL: http://svn.apache.org/viewvc?rev=1438444&view=rev
Log:
Merged revisions 1435037,1438435 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes

................
  r1435037 | ema | 2013-01-18 14:12:32 +0800 (Fri, 18 Jan 2013) | 16 lines
  
  Merged revisions 1435036 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes
  
  ................
    r1435036 | ema | 2013-01-18 14:09:01 +0800 (Fri, 18 Jan 2013) | 9 lines
    
    Merged revisions 1435034 via svnmerge from 
    https://svn.apache.org/repos/asf/cxf/trunk
    
    ........
      r1435034 | ema | 2013-01-18 14:03:23 +0800 (Fri, 18 Jan 2013) | 1 line
      
      CXF-4735:@XmlJavaTypeAdapter ignored on exception setters(Patch from Richard)
    ........
  ................
................
  r1438435 | ema | 2013-01-25 18:43:00 +0800 (Fri, 25 Jan 2013) | 20 lines
  
  Merged revisions 1438427,1438432 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes
  
  ................
    r1438427 | ema | 2013-01-25 18:28:28 +0800 (Fri, 25 Jan 2013) | 9 lines
    
    Merged revisions 1438421 via svnmerge from 
    https://svn.apache.org/repos/asf/cxf/trunk
    
    ........
      r1438421 | ema | 2013-01-25 18:22:48 +0800 (Fri, 25 Jan 2013) | 1 line
      
      [CXF-4735]:Fix the jaxb Utils.getGetters doesn't exclude toString()
    ........
  ................
    r1438432 | ema | 2013-01-25 18:38:28 +0800 (Fri, 25 Jan 2013) | 1 line
    
    [CXF-4735]:Add the test case not merged by previous commit
  ................
................

Added:
    cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/UtilsTest.java
      - copied unchanged from r1438435, cxf/branches/2.6.x-fixes/rt/databinding/jaxb/src/test/java/org/apache/cxf/jaxb/UtilsTest.java
Modified:
    cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java

Modified: cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java?rev=1438444&r1=1438443&r2=1438444&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/Utils.java
Fri Jan 25 10:53:31 2013
@@ -148,22 +148,27 @@ final class Utils {
     }
     
     private static boolean isGetter(Method m) {
-        Class<?> declaringClass = m.getDeclaringClass();
-        if (m.getReturnType() != Void.class && m.getParameterTypes().length == 0)
{
-            final int index = getterIndex(m.getName());
-            if (index != -1) {
-                String setterName = "set" + m.getName().substring(index);
-                Class<?> paramTypes = m.getReturnType();
-                Method setter = getDeclaredMethod(declaringClass, setterName, paramTypes);
-                
-                if (setter != null && setter.isAnnotationPresent(XmlTransient.class))
{
-                    return false;
-                } 
+        if (m.getReturnType() != Void.class && m.getReturnType() != Void.TYPE &&
m.getParameterTypes().length == 0) {
+            Method setter = getSetter(m);
+            if (setter != null) {
+                return !setter.isAnnotationPresent(XmlTransient.class);
+            }
+            if (getterIndex(m.getName()) > -1) {
                 return true;
             }
         }
         return false;
     }
+
+    private static Method getSetter(Method m) {
+        final int index = getterIndex(m.getName());
+        if (index != -1) {
+            String setterName = "set" + m.getName().substring(index);
+            Class<?> paramTypes = m.getReturnType();
+            return getDeclaredMethod(m.getDeclaringClass(), setterName, paramTypes);
+        }
+        return null;
+    }
     
     private static boolean isSetter(Method m) {
         Class<?> declaringClass = m.getDeclaringClass();
@@ -266,6 +271,12 @@ final class Utils {
     static XmlJavaTypeAdapter getMethodXJTA(final Method m) {
         XmlJavaTypeAdapter adapter = m.getAnnotation(XmlJavaTypeAdapter.class);
         if (adapter == null) {
+            Method setter = getSetter(m);
+            if (setter != null) {
+                adapter = setter.getAnnotation(XmlJavaTypeAdapter.class);
+            }
+        }
+        if (adapter == null) {
             adapter = m.getReturnType().getAnnotation(XmlJavaTypeAdapter.class);
         }
         if (adapter == null) {
@@ -281,7 +292,7 @@ final class Utils {
         }
         return adapter;
     }
-
+    
     static Type getTypeFromXmlAdapter(XmlJavaTypeAdapter xjta) {
         if (xjta != null) {
             Class<?> c2 = xjta.value();



Mime
View raw message