cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6322] Adding another check for ParameterConverter
Date Fri, 03 Apr 2015 15:17:24 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes c158293c3 -> b81976817


[CXF-6322] Adding another check for ParameterConverter


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/b8197681
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/b8197681
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/b8197681

Branch: refs/heads/3.0.x-fixes
Commit: b81976817985fe9feb90bedd967793dc1febc327
Parents: c158293
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Fri Apr 3 16:16:15 2015 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Fri Apr 3 16:17:05 2015 +0100

----------------------------------------------------------------------
 .../search/AbstractSearchConditionParser.java   | 21 ++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/b8197681/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionParser.java
----------------------------------------------------------------------
diff --git a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionParser.java
b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionParser.java
index 2eda542..5721c8b 100644
--- a/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionParser.java
+++ b/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionParser.java
@@ -37,6 +37,7 @@ import org.apache.cxf.common.util.PropertyUtils;
 import org.apache.cxf.jaxrs.ext.search.Beanspector.TypeInfo;
 import org.apache.cxf.jaxrs.ext.search.collections.CollectionCheck;
 import org.apache.cxf.jaxrs.ext.search.collections.CollectionCheckInfo;
+import org.apache.cxf.jaxrs.provider.ServerProviderFactory;
 import org.apache.cxf.jaxrs.utils.InjectionUtils;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
@@ -44,13 +45,12 @@ import org.apache.cxf.message.MessageUtils;
 
 public abstract class AbstractSearchConditionParser<T> implements SearchConditionParser<T>
{
     
-    
+    private static final Annotation[] EMPTY_ANNOTTAIONS = new Annotation[]{};
     protected final Map<String, String> contextProperties;
     protected final Class<T> conditionClass;
     protected Beanspector<T> beanspector;       
     protected Map<String, String> beanPropertiesMap;
-    
-    
+        
     protected AbstractSearchConditionParser(Class<T> tclass) {
         this(tclass, Collections.<String, String>emptyMap(), null);
     }
@@ -167,7 +167,11 @@ public abstract class AbstractSearchConditionParser<T> implements
SearchConditio
                 boolean isPrimitive = !returnCollection 
                     && InjectionUtils.isPrimitive(returnType) || returnType.isEnum();
                 boolean lastTry = names.length == 2 
-                    && (isPrimitive || Date.class.isAssignableFrom(returnType) ||
returnCollection);
+                    && (isPrimitive 
+                        || 
+                        Date.class.isAssignableFrom(returnType) 
+                        || returnCollection
+                        || paramConverterAvailable(returnType));
                 
                 Object valueObject = ownerBean != null ? ownerBean 
                     : actualType.isInterface() 
@@ -226,6 +230,15 @@ public abstract class AbstractSearchConditionParser<T> implements
SearchConditio
         }
     }
 
+    private boolean paramConverterAvailable(Class<?> pClass) {
+        Message m = JAXRSUtils.getCurrentMessage();
+        ServerProviderFactory pf = m == null ? null : ServerProviderFactory.getInstance(m);
+        if (pf != null && pf.createParameterHandler(pClass, pClass, EMPTY_ANNOTTAIONS)
!= null) {
+            return true;
+        }
+        return false;
+    }
+
     private CollectionCheck getCollectionCheck(String propName, boolean isCollection, Class<?>
actualCls) {
         if (isCollection) {
             if (InjectionUtils.isPrimitive(actualCls)) {


Mime
View raw message