cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1229332 [1/5] - in /cxf/trunk: common/common/src/main/java/org/apache/cxf/common/util/ rt/core/src/main/java/org/apache/cxf/bus/osgi/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxr...
Date Mon, 09 Jan 2012 20:07:23 GMT
Author: dkulp
Date: Mon Jan  9 20:07:20 2012
New Revision: 1229332

URL: http://svn.apache.org/viewvc?rev=1229332&view=rev
Log:
Cleanup rawtypes issues in JAX-RS

Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/PrimitiveUtils.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/CXFActivator.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/WorkQueueSingleConfig.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceImpl.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/blueprint/JAXRSBPNamespaceHandler.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ResponseReader.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ServerWebApplicationException.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/MessageContextImpl.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/PrimitiveSearchCondition.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/XMLSource.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RuntimeDelegateImpl.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalContextResolver.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalSearchContext.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ProviderInfo.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AtomPojoProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/BinaryDataProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXRSDataBinding.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONUtils.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/SourceProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XMLBeansElementProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XPathProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSClientFactoryBeanDefinitionParser.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/AttachmentUtils.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/CustomerInfo.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXBContextProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/fortest/AbstractEntity2.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/AtomPojoProviderTest.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/BinaryDataProviderTest.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/DataBindingJSONProviderTest.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/DataBindingProviderTest.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/DataSourceProviderTest.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/FormEncodingProviderTest.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/JAXBElementProviderTest.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/JSONProviderTest.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/NoNamespaceJava5TypeCreator.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/NoNamespaceTypeCreator.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProviderTest.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/ProviderFactoryTest.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/SourceProviderTest.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/XPathProviderTest.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProviderTest.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/Structure.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/resources/sdo/impl/StructureImpl.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanTest.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/JAXRSUtilsTest.java
    cxf/trunk/rt/management-web/src/main/java/org/apache/cxf/management/web/browser/bootstrapping/BootstrapStorage.java
    cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/saml/SamlFormInHandler.java
    cxf/trunk/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/AbstractXmlSecOutInterceptor.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookServer.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/GenericHandlerWriter.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerBookTest.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerSpringBookTest.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSClientServerStreamingTest.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
    cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/StringTextWriter.java
    cxf/trunk/systests/rs-security/src/test/java/org/apache/cxf/systest/jaxrs/security/saml/JAXRSSamlTest.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/security/WSSecurityClientTest.java

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/PrimitiveUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/PrimitiveUtils.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/PrimitiveUtils.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/PrimitiveUtils.java Mon Jan  9 20:07:20 2012
@@ -54,33 +54,32 @@ public final class PrimitiveUtils {
         return clz;
     }
 
-    public static Object read(String value, Class<?> type) {
+    public static <T> Object read(String value, Class<T> type) {
         Object ret = value;
-        if (Integer.TYPE.equals(type)) {
+        if (Integer.TYPE.equals(type) || Integer.class.equals(type)) {
             ret = Integer.valueOf(value);
         }
-        if (Byte.TYPE.equals(type)) {
+        if (Byte.TYPE.equals(type) || Byte.class.equals(type)) {
             ret = Byte.valueOf(value);
         }
-        if (Short.TYPE.equals(type)) {
+        if (Short.TYPE.equals(type) || Short.class.equals(type)) {
             ret = Short.valueOf(value);
         }
-        if (Long.TYPE.equals(type)) {
+        if (Long.TYPE.equals(type) || Long.class.equals(type)) {
             ret = Long.valueOf(value);
         }
-        if (Float.TYPE.equals(type)) {
+        if (Float.TYPE.equals(type) || Float.class.equals(type)) {
             ret = Float.valueOf(value);
         }
-        if (Double.TYPE.equals(type)) {
+        if (Double.TYPE.equals(type) || Double.class.equals(type)) {
             ret = Double.valueOf(value);
         }
-        if (Boolean.TYPE.equals(type)) {
+        if (Boolean.TYPE.equals(type) || Boolean.class.equals(type)) {
             ret = Boolean.valueOf(value);
         }
-        if (Character.TYPE.equals(type)) {
+        if (Character.TYPE.equals(type) || Character.class.equals(type)) {
             ret = value.charAt(0);
         }
-        // TODO others.
         return ret;
     }
 }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/CXFActivator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/CXFActivator.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/CXFActivator.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/CXFActivator.java Mon Jan  9 20:07:20 2012
@@ -50,6 +50,7 @@ public class CXFActivator implements Bun
     private ServiceRegistration wqSingleConfigRegistratin;
 
     /** {@inheritDoc}*/
+    @SuppressWarnings("deprecation")
     public void start(BundleContext context) throws Exception {
         cxfBundleListener = new CXFExtensionBundleListener(context.getBundle().getBundleId());
         context.addBundleListener(cxfBundleListener);
@@ -74,7 +75,7 @@ public class CXFActivator implements Bun
     }
 
     private ServiceRegistration registerManagedServiceFactory(BundleContext context,
-                                                              Class serviceClass,
+                                                              Class<?> serviceClass,
                                                               Object service, 
                                                               String servicePid) {
         Properties props = new Properties();

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/WorkQueueSingleConfig.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/WorkQueueSingleConfig.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/WorkQueueSingleConfig.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/osgi/WorkQueueSingleConfig.java Mon Jan  9 20:07:20 2012
@@ -22,6 +22,7 @@ import java.util.Dictionary;
 import java.util.Enumeration;
 import java.util.Hashtable;
 
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.workqueue.AutomaticWorkQueueImpl;
 import org.osgi.service.cm.ConfigurationException;
 import org.osgi.service.cm.ManagedService;
@@ -39,18 +40,19 @@ public class WorkQueueSingleConfig imple
         this.workQueueList = workQueueList;
     }
 
-    public void updated(Dictionary properties) throws ConfigurationException {
+    public void updated(@SuppressWarnings("rawtypes") Dictionary properties) throws ConfigurationException {
+        Dictionary<String, String> p = CastUtils.cast(properties);
         String names = (String)properties.get(PROPERTY_PREFIX + ".names");
         String[] nameAr = names.split(",");
         for (String name : nameAr) {
-            updateQueue(name.trim(), properties);
+            updateQueue(name.trim(), p);
         }
     }
 
-    private void updateQueue(String name, Dictionary properties) 
+    private void updateQueue(String name, Dictionary<String, String> properties) 
         throws ConfigurationException {
         Dictionary<String, String> queueProperties = new Hashtable<String, String>();
-        Enumeration it = properties.keys();
+        Enumeration<?> it = properties.keys();
         while (it.hasMoreElements()) {
             String key = (String)it.nextElement();
             String prefix = PROPERTY_PREFIX + "." + name + ".";

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/AbstractJAXRSFactoryBean.java Mon Jan  9 20:07:20 2012
@@ -358,7 +358,7 @@ public class AbstractJAXRSFactoryBean ex
             }
             db.initialize(s);
         }
-        factory.setUserProviders(Collections.singletonList(new DataBindingProvider(db)));
+        factory.setUserProviders(Collections.singletonList(new DataBindingProvider<Object>(db)));
     }
     
     /**

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSInvoker.java Mon Jan  9 20:07:20 2012
@@ -136,7 +136,7 @@ public class JAXRSInvoker extends Abstra
                                               exchange.getInMessage());
                 
                 ProviderInfo<?> appProvider = 
-                    (ProviderInfo)exchange.getEndpoint().get(Application.class.getName());
+                    (ProviderInfo<?>)exchange.getEndpoint().get(Application.class.getName());
                 if (appProvider != null) {
                     InjectionUtils.injectContexts(appProvider.getProvider(),
                                                   appProvider,
@@ -264,7 +264,7 @@ public class JAXRSInvoker extends Abstra
     }
 
     @SuppressWarnings("unchecked")
-    protected MultivaluedMap getTemplateValues(Message msg) {
+    protected MultivaluedMap<String, String> getTemplateValues(Message msg) {
         MultivaluedMap<String, String> values = new MetadataMap<String, String>();
         MultivaluedMap<String, String> oldValues = 
             (MultivaluedMap<String, String>)msg.get(URITemplate.TEMPLATE_PARAMETERS);
@@ -324,7 +324,7 @@ public class JAXRSInvoker extends Abstra
             if (result instanceof MessageContentsList) {
                 result = ((MessageContentsList)result).get(0);
             } else if (result instanceof List) {
-                result = ((List)result).get(0);
+                result = ((List<?>)result).get(0);
             } else if (result.getClass().isArray()) {
                 result = ((Object[])result)[0];
             }
@@ -341,7 +341,6 @@ public class JAXRSInvoker extends Abstra
         return result;
     }
 
-    @SuppressWarnings("unchecked")
     private void pushOntoStack(OperationResourceInfo ori, Class<?> realClass, Message msg) {
         OperationResourceInfoStack stack = msg.get(OperationResourceInfoStack.class);
         if (stack == null) {
@@ -350,8 +349,9 @@ public class JAXRSInvoker extends Abstra
         }
         
         
+        @SuppressWarnings("unchecked")
         MultivaluedMap<String, String> params = 
-            (MultivaluedMap)msg.get(URITemplate.TEMPLATE_PARAMETERS);
+            (MultivaluedMap<String, String>)msg.get(URITemplate.TEMPLATE_PARAMETERS);
         List<String> values = null;
         if (params == null || params.size() == 1) {
             values = Collections.emptyList();

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java Mon Jan  9 20:07:20 2012
@@ -70,7 +70,7 @@ import org.apache.cxf.service.invoker.In
  */
 public class JAXRSServerFactoryBean extends AbstractJAXRSFactoryBean {
     
-    protected Map<Class, ResourceProvider> resourceProviders = new HashMap<Class, ResourceProvider>();
+    protected Map<Class<?>, ResourceProvider> resourceProviders = new HashMap<Class<?>, ResourceProvider>();
     
     private Server server;
     private boolean start = true;
@@ -251,7 +251,7 @@ public class JAXRSServerFactoryBean exte
      * Sets one or more root resource classes 
      * @param classes the list of resource classes
      */
-    public void setResourceClasses(List<Class> classes) {
+    public void setResourceClasses(List<Class<?>> classes) {
         serviceFactory.setResourceClasses(classes);
     }
 
@@ -259,7 +259,7 @@ public class JAXRSServerFactoryBean exte
      * Sets one or more root resource classes 
      * @param classes the array of resource classes
      */
-    public void setResourceClasses(Class... classes) {
+    public void setResourceClasses(Class<?>... classes) {
         serviceFactory.setResourceClasses(classes);
     }
     
@@ -304,7 +304,7 @@ public class JAXRSServerFactoryBean exte
      * @param c resource class
      * @param rp resource provider
      */
-    public void setResourceProvider(Class c, ResourceProvider rp) {
+    public void setResourceProvider(Class<?> c, ResourceProvider rp) {
         resourceProviders.put(c, rp);
     }
     

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceFactoryBean.java Mon Jan  9 20:07:20 2012
@@ -130,7 +130,7 @@ public class JAXRSServiceFactoryBean ext
         return classResourceInfos;
     }
     
-    public void setResourceClass(Class cls) {
+    public void setResourceClass(Class<?> cls) {
         if (getCreatedFromModel(cls) == null) {
             classResourceInfos.clear();
             boolean isRoot = AnnotationUtils.getClassAnnotation(cls, Path.class) != null;
@@ -138,8 +138,8 @@ public class JAXRSServiceFactoryBean ext
         }
     }
     
-    public void setResourceClasses(List<Class> classes) {
-        for (Class resourceClass : classes) {
+    public void setResourceClasses(List<Class<?>> classes) {
+        for (Class<?> resourceClass : classes) {
             
             ClassResourceInfo cri = getCreatedFromModel(resourceClass);
             if (cri != null) {
@@ -186,7 +186,7 @@ public class JAXRSServiceFactoryBean ext
         return map;
     }
     
-    protected ClassResourceInfo createResourceInfo(Class cls, boolean isRoot) {
+    protected ClassResourceInfo createResourceInfo(Class<?> cls, boolean isRoot) {
         ClassResourceInfo classResourceInfo = 
             ResourceUtils.createClassResourceInfo(cls, cls, isRoot, enableStatic);
         if (classResourceInfo != null) {
@@ -195,7 +195,7 @@ public class JAXRSServiceFactoryBean ext
         return classResourceInfo;
     }
 
-    public void setResourceClasses(Class... classes) {
+    public void setResourceClasses(Class<?>... classes) {
         setResourceClasses(Arrays.asList(classes));
     }
     

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceImpl.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServiceImpl.java Mon Jan  9 20:07:20 2012
@@ -99,7 +99,7 @@ public class JAXRSServiceImpl extends Ab
             return serviceName;
         }
         if (address == null) {
-            Class primaryClass = classResourceInfos.get(0).getServiceClass();
+            Class<?> primaryClass = classResourceInfos.get(0).getServiceClass();
             String ns = PackageUtils.getNamespace(PackageUtils.getPackageName(primaryClass));
             return new QName(ns, primaryClass.getSimpleName());
         } else {

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/blueprint/JAXRSBPNamespaceHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/blueprint/JAXRSBPNamespaceHandler.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/blueprint/JAXRSBPNamespaceHandler.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/blueprint/JAXRSBPNamespaceHandler.java Mon Jan  9 20:07:20 2012
@@ -55,6 +55,7 @@ public class JAXRSBPNamespaceHandler imp
         return null;
     }
 
+    @SuppressWarnings("rawtypes")
     public Set<Class> getManagedClasses() {
         return null;
     }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java Mon Jan  9 20:07:20 2012
@@ -382,19 +382,23 @@ public abstract class AbstractClient imp
         state.setResponseBuilder(currentResponseBuilder);
         return rb;
     }
-
-    @SuppressWarnings("unchecked")
-    protected void writeBody(Object o, Message outMessage, Class<?> cls, Type type, Annotation[] anns, 
-        MultivaluedMap<String, String> headers, OutputStream os) {
+    protected <T> void writeBody(T o, Message outMessage, Type type, Annotation[] anns,
+                                 MultivaluedMap<String, Object> headers, OutputStream os) {
+        @SuppressWarnings("unchecked")
+        Class<T> cls = (Class<T>)o.getClass();
+        writeBody(o, outMessage, cls, type, anns, headers, os);
+    }       
+    protected <T> void writeBody(T o, Message outMessage, Class<T> cls, Type type, Annotation[] anns, 
+        MultivaluedMap<String, Object> headers, OutputStream os) {
         
         if (o == null) {
             return;
         }
         
-        MediaType contentType = MediaType.valueOf(headers.getFirst("Content-Type")); 
+        MediaType contentType = MediaType.valueOf(headers.getFirst("Content-Type").toString()); 
         
-        MessageBodyWriter mbw = ProviderFactory.getInstance(outMessage).createMessageBodyWriter(
-            cls, type, anns, contentType, outMessage);
+        MessageBodyWriter<T> mbw = ProviderFactory.getInstance(outMessage)
+            .createMessageBodyWriter(cls, type, anns, contentType, outMessage);
         if (mbw != null) {
             try {
                 mbw.writeTo(o, cls, type, anns, contentType, headers, os);
@@ -411,12 +415,12 @@ public abstract class AbstractClient imp
     }
     
     @SuppressWarnings("unchecked")
-    protected Object readBody(Response r, Message inMessage, Class<?> cls, 
-                              Type type, Annotation[] anns) {
+    protected <T> T readBody(Response r, Message inMessage, Class<T> cls, 
+                             Type type, Annotation[] anns) {
 
         InputStream inputStream = (InputStream)r.getEntity();
         if (inputStream == null) {
-            return cls == Response.class ? r : null;
+            return cls == Response.class ? cls.cast(r) : null;
         }
         
         int status = r.getStatus();
@@ -424,23 +428,31 @@ public abstract class AbstractClient imp
             Object length = r.getMetadata().getFirst(HttpHeaders.CONTENT_LENGTH);
             if (length == null || Integer.parseInt(length.toString()) == 0
                 || status >= 400) {
-                return cls == Response.class ? r : status >= 400 ? inputStream : null;
+                if (cls == Response.class) {
+                    return cls.cast(r);
+                } else {
+                    return null;
+                }
             }
         }
         
         MediaType contentType = getResponseContentType(r);
         
-        MessageBodyReader mbr = ProviderFactory.getInstance(inMessage).createMessageBodyReader(
-            cls, type, anns, contentType, inMessage);
+        MessageBodyReader<T> mbr 
+            = ProviderFactory.getInstance(inMessage).createMessageBodyReader(
+                cls, type, anns, contentType, inMessage);
         if (mbr != null) {
             try {
-                return mbr.readFrom(cls, type, anns, contentType, 
-                       new MetadataMap<String, Object>(r.getMetadata(), true, true), inputStream);
+                MultivaluedMap<String, String> m 
+                    = (MultivaluedMap<String, String>)
+                        ((MultivaluedMap<?, ?>)new MetadataMap<String, Object>(r.getMetadata(),
+                            true, true));
+                return mbr.readFrom(cls, type, anns, contentType, m, inputStream);
             } catch (Exception ex) {
                 reportMessageHandlerProblem("MSG_READER_PROBLEM", cls, contentType, ex, r);
             }
         } else if (cls == Response.class) {
-            return r;
+            return cls.cast(r);
         } else {
             reportMessageHandlerProblem("NO_MSG_READER", cls, contentType, null, null);
         }
@@ -471,7 +483,7 @@ public abstract class AbstractClient imp
         }
         checkClientException(message, message.getExchange().get(Exception.class));
         
-        List result = message.getExchange().get(List.class);
+        List<?> result = message.getExchange().get(List.class);
         return result != null ? result.toArray() : null;
     }
     
@@ -516,7 +528,7 @@ public abstract class AbstractClient imp
         
         try {
             Object body = params.length == 0 ? null : params[0];
-            Map<String, Object> reqContext = CastUtils.cast((Map)context.get(REQUEST_CONTEXT));
+            Map<String, Object> reqContext = CastUtils.cast((Map<?, ?>)context.get(REQUEST_CONTEXT));
             MultivaluedMap<String, String> headers = 
                 (MultivaluedMap<String, String>)reqContext.get(Message.PROTOCOL_HEADERS);
                         
@@ -553,7 +565,7 @@ public abstract class AbstractClient imp
             
             if (InjectionUtils.isSupportedCollectionOrArray(pValue.getClass())) {
                 Collection<?> c = pValue.getClass().isArray() 
-                    ? Arrays.asList((Object[]) pValue) : (Collection) pValue;
+                    ? Arrays.asList((Object[]) pValue) : (Collection<?>) pValue;
                 for (Iterator<?> it = c.iterator(); it.hasNext();) {
                     addToBuilder(ub, paramName, it.next(), pt);
                 }
@@ -759,11 +771,12 @@ public abstract class AbstractClient imp
     }
     
     protected Map<String, Object> getRequestContext(Message outMessage) {
-        Map<String, Object> invContext = CastUtils.cast((Map)outMessage.get(Message.INVOCATION_CONTEXT));
-        return CastUtils.cast((Map)invContext.get(REQUEST_CONTEXT));
+        Map<String, Object> invContext 
+            = CastUtils.cast((Map<?, ?>)outMessage.get(Message.INVOCATION_CONTEXT));
+        return CastUtils.cast((Map<?, ?>)invContext.get(REQUEST_CONTEXT));
     }
     
-    protected List getContentsList(Object body) {
+    protected List<?> getContentsList(Object body) {
         return body == null ? new MessageContentsList() : new MessageContentsList(body);
     }
     
@@ -788,8 +801,8 @@ public abstract class AbstractClient imp
         if (context == null) {
             context = new HashMap<String, Object>();
         }
-        reqContext = CastUtils.cast((Map)context.get(REQUEST_CONTEXT));
-        resContext = CastUtils.cast((Map)context.get(RESPONSE_CONTEXT));
+        reqContext = CastUtils.cast((Map<?, ?>)context.get(REQUEST_CONTEXT));
+        resContext = CastUtils.cast((Map<?, ?>)context.get(RESPONSE_CONTEXT));
         if (reqContext == null) { 
             reqContext = new HashMap<String, Object>(cfg.getRequestContext());
             context.put(REQUEST_CONTEXT, reqContext);

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientProxyImpl.java Mon Jan  9 20:07:20 2012
@@ -409,7 +409,7 @@ public class ClientProxyImpl extends Abs
             if (pValue != null) {
                 if (InjectionUtils.isSupportedCollectionOrArray(pValue.getClass())) {
                     Collection<?> c = pValue.getClass().isArray() 
-                        ? Arrays.asList((Object[]) pValue) : (Collection) pValue;
+                        ? Arrays.asList((Object[]) pValue) : (Collection<?>) pValue;
                     for (Iterator<?> it = c.iterator(); it.hasNext();) {
                         FormUtils.addPropertyToForm(form, p.getName(), it.next());
                     }
@@ -502,7 +502,7 @@ public class ClientProxyImpl extends Abs
                                  Exchange exchange, 
                                  Map<String, Object> invContext) throws Throwable {
         
-        Map<String, Object> reqContext = CastUtils.cast((Map)invContext.get(REQUEST_CONTEXT));
+        Map<String, Object> reqContext = CastUtils.cast((Map<?, ?>)invContext.get(REQUEST_CONTEXT));
         int bodyIndex = body != null ? (Integer)reqContext.get("BODY_INDEX") : -1;
         OperationResourceInfo ori = 
             (OperationResourceInfo)reqContext.get(OperationResourceInfo.class.getName());
@@ -566,8 +566,8 @@ public class ClientProxyImpl extends Abs
             if (objs == null || objs.size() == 0) {
                 return;
             }
-            MultivaluedMap<String, String> headers = 
-                (MultivaluedMap)outMessage.get(Message.PROTOCOL_HEADERS);
+            MultivaluedMap<String, Object> headers = 
+                (MultivaluedMap<String, Object>)outMessage.get(Message.PROTOCOL_HEADERS);
             Method method = ori.getMethodToInvoke();
             int bodyIndex = (Integer)outMessage.get("BODY_INDEX");
             Method aMethod = ori.getAnnotatedMethod();
@@ -576,11 +576,11 @@ public class ClientProxyImpl extends Abs
             Object body = objs.get(0);
             try {
                 if (bodyIndex != -1) {
-                    writeBody(body, outMessage, body.getClass(), 
+                    writeBody(body, outMessage,
                               method.getGenericParameterTypes()[bodyIndex],
                               anns, headers, os);
                 } else {
-                    writeBody(body, outMessage, body.getClass(), body.getClass(), 
+                    writeBody(body, outMessage, body.getClass(), 
                               anns, headers, os);
                 }
             } catch (Exception ex) {

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/JAXRSClientFactoryBean.java Mon Jan  9 20:07:20 2012
@@ -19,6 +19,7 @@
 package org.apache.cxf.jaxrs.client;
 
 import java.net.URI;
+import java.util.List;
 import java.util.Map;
 import java.util.logging.Logger;
 
@@ -49,7 +50,7 @@ public class JAXRSClientFactoryBean exte
     private MultivaluedMap<String, String> headers;
     private ClientState initialState;
     private boolean threadSafe; 
-    private Class serviceClass;
+    private Class<?> serviceClass;
     
     public JAXRSClientFactoryBean() {
         this(new JAXRSServiceFactoryBean());
@@ -168,7 +169,7 @@ public class JAXRSClientFactoryBean exte
      * Gets the initial headers
      * @return the headers
      */
-    public Map getHeaders() {
+    public Map<String, List<String>> getHeaders() {
         return headers;
     }
     

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ResponseReader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ResponseReader.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ResponseReader.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ResponseReader.java Mon Jan  9 20:07:20 2012
@@ -57,8 +57,8 @@ public class ResponseReader implements M
         return cls.isAssignableFrom(Response.class);
     }
 
-    @SuppressWarnings("unchecked")
-    public Response readFrom(Class<Response> cls, Type genericType, Annotation[] anns, MediaType mt,
+    public Response readFrom(Class<Response> cls, Type genericType,
+                             Annotation[] anns, MediaType mt,
         MultivaluedMap<String, String> headers, InputStream is) 
         throws IOException, WebApplicationException {
         
@@ -74,23 +74,29 @@ public class ResponseReader implements M
         }
         
         if (entityCls != null) {
-            Providers providers = getContext().getProviders();
-            MessageBodyReader<?> reader = 
-                providers.getMessageBodyReader(entityCls, getEntityGenericType(), anns, mt);
-            if (reader == null) {
-                throw new ClientWebApplicationException("No reader for Response entity "
-                                                        + entityCls.getName());
-            }
-            
-            Object entity = reader.readFrom((Class)entityCls, getEntityGenericType(), 
-                                            anns, mt, headers, is);
+            Object entity = readFrom(entityCls, anns, mt, headers, is);
             rb.entity(entity);
         }
         
-        
         return rb.build();
     }
-
+    private <T> T readFrom(Class<T> type,  
+               Annotation anns[], MediaType mt,
+               MultivaluedMap<String, String> headers, 
+               InputStream is) throws IOException, WebApplicationException {
+        
+        Providers providers = getContext().getProviders();
+        MessageBodyReader<T> reader = 
+            providers.getMessageBodyReader(type, getEntityGenericType(), anns, mt);
+        if (reader == null) {
+            throw new ClientWebApplicationException("No reader for Response entity "
+                                                    + entityCls.getName());
+        }
+        
+        return reader.readFrom(type, getEntityGenericType(), 
+                               anns, mt, headers, is);
+    }
+       
     public void setEntityClass(Class<?> cls) {
         entityCls = cls;
     }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ServerWebApplicationException.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ServerWebApplicationException.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ServerWebApplicationException.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ServerWebApplicationException.java Mon Jan  9 20:07:20 2012
@@ -86,7 +86,9 @@ public class ServerWebApplicationExcepti
     
     @SuppressWarnings("unchecked")
     public MultivaluedMap<String, String> getHeaders() {
-        return (MultivaluedMap)super.getResponse().getMetadata();
+        MultivaluedMap<?, ?> mp = super.getResponse().getMetadata();
+        //need to bounce through the temp so the cast will work
+        return (MultivaluedMap<String, String>)mp;
     }
     
     @Override
@@ -141,11 +143,10 @@ public class ServerWebApplicationExcepti
      * @param cls the entity class
      * @return the typed entity
      */
-    @SuppressWarnings("unchecked")
     public <T> T toErrorObject(Client client, Class<T> entityCls) {
         Response response = getResponse();
         try {
-            MultivaluedMap headers = response.getMetadata();
+            MultivaluedMap<String, String> headers = getHeaders();
             Object contentType = headers.getFirst("Content-Type");
             InputStream inputStream = (InputStream)response.getEntity();
             if (contentType == null || inputStream == null) {
@@ -166,7 +167,7 @@ public class ServerWebApplicationExcepti
             
             ProviderFactory pf = (ProviderFactory)ep.get(ProviderFactory.class.getName());
             
-            MessageBodyReader reader = pf.createMessageBodyReader(entityCls, 
+            MessageBodyReader<T> reader = pf.createMessageBodyReader(entityCls, 
                                                              entityCls, 
                                                              annotations, 
                                                              mt, 

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/WebClient.java Mon Jan  9 20:07:20 2012
@@ -762,6 +762,13 @@ public class WebClient extends AbstractC
             
             Object entity = readBody(currentResponse, outMessage, responseClass, genericType,
                                      new Annotation[]{});
+            
+            if (entity == null) {
+                int status = currentResponse.getStatus();
+                if (status >= 400) {
+                    entity = currentResponse.getEntity();
+                }
+            }
             rb.entity(entity instanceof Response 
                       ? ((Response)entity).getEntity() : entity);
             
@@ -791,8 +798,8 @@ public class WebClient extends AbstractC
             if (objs == null || objs.size() == 0) {
                 return;
             }
-            MultivaluedMap<String, String> headers = 
-                (MultivaluedMap<String, String>)outMessage.get(Message.PROTOCOL_HEADERS);
+            MultivaluedMap<String, Object> headers = 
+                (MultivaluedMap<String, Object>)outMessage.get(Message.PROTOCOL_HEADERS);
             Object body = objs.get(0);
             
             Map<String, Object> requestContext = WebClient.this.getRequestContext(outMessage);
@@ -801,7 +808,7 @@ public class WebClient extends AbstractC
                 type = (Type)requestContext.get(REQUEST_TYPE);
             }
             try {
-                writeBody(body, outMessage, body.getClass(), type == null ? body.getClass() : type, 
+                writeBody(body, outMessage, type == null ? body.getClass() : type, 
                           new Annotation[]{}, headers, os);
                 if (os != null) {
                     os.flush();

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/MessageContextImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/MessageContextImpl.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/MessageContextImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/MessageContextImpl.java Mon Jan  9 20:07:20 2012
@@ -171,7 +171,7 @@ public class MessageContextImpl implemen
     }
 
     private void convertToAttachments(Object value) {
-        List<?> handlers = (List)value;
+        List<?> handlers = (List<?>)value;
         List<org.apache.cxf.message.Attachment> atts = 
             new ArrayList<org.apache.cxf.message.Attachment>();
         

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/PrimitiveSearchCondition.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/PrimitiveSearchCondition.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/PrimitiveSearchCondition.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/PrimitiveSearchCondition.java Mon Jan  9 20:07:20 2012
@@ -99,7 +99,7 @@ public class PrimitiveSearchCondition<T>
         return pojo.getClass().getName().startsWith("java.lang");
     }
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     private boolean compare(Object lval, ConditionType cond, Object rval) {
         boolean compares = true;
         if (cond == ConditionType.EQUALS || cond == ConditionType.NOT_EQUALS) {

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/XMLSource.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/XMLSource.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/XMLSource.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/XMLSource.java Mon Jan  9 20:07:20 2012
@@ -112,13 +112,14 @@ public class XMLSource {
      * @param cls class of the node
      * @return the instance representing the matching node
      */
+    @SuppressWarnings("unchecked")
     public <T> T getNode(String expression, Map<String, String> namespaces, Class<T> cls) {
         Node node = (Node)evaluate(expression, namespaces, XPathConstants.NODE);
         if (node == null) {
             return null;
         }
         if (cls.isPrimitive() || cls == String.class) {
-            return readPrimitiveValue(node, cls);    
+            return (T)readPrimitiveValue(node, cls);    
         } else {
             return readNode(node, cls);
         }
@@ -160,7 +161,7 @@ public class XMLSource {
         for (int i = 0; i < nodes.getLength(); i++) {
             Node node = nodes.item(i);
             if (InjectionUtils.isPrimitive(cls)) {
-                values[i] = readPrimitiveValue(node, cls);
+                values[i] = (T)readPrimitiveValue(node, cls);
             } else {
                 values[i] = readNode(node, cls);
             }
@@ -278,9 +279,10 @@ public class XMLSource {
      * @param cls the class of the response
      * @return the value
      */
+    @SuppressWarnings("unchecked")
     public <T> T getValue(String expression, Map<String, String> namespaces, Class<T> cls) {
         Object result = evaluate(expression, namespaces, XPathConstants.STRING);
-        return result == null ? null : InjectionUtils.convertStringToPrimitive(result.toString(), cls); 
+        return result == null ? null : (T)InjectionUtils.convertStringToPrimitive(result.toString(), cls); 
     }
     
     
@@ -325,7 +327,7 @@ public class XMLSource {
         }
     }
     
-    private <T> T readPrimitiveValue(Node node, Class<T> cls) {
+    private <T> Object readPrimitiveValue(Node node, Class<T> cls) {
         if (String.class == cls) {
             if (node.getNodeType() == Node.ELEMENT_NODE) {
                 ByteArrayOutputStream bos = new ByteArrayOutputStream();
@@ -357,7 +359,7 @@ public class XMLSource {
         
         try {
             
-            JAXBElementProvider provider = new JAXBElementProvider();
+            JAXBElementProvider<?> provider = new JAXBElementProvider<Object>();
             JAXBContext c = provider.getPackageContext(cls);
             if (c == null) {
                 c = provider.getClassContext(cls);

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RuntimeDelegateImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RuntimeDelegateImpl.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RuntimeDelegateImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/RuntimeDelegateImpl.java Mon Jan  9 20:07:20 2012
@@ -40,8 +40,8 @@ import org.apache.cxf.jaxrs.utils.Resour
 
 
 public class RuntimeDelegateImpl extends RuntimeDelegate {
-    protected Map<Class<?>, HeaderDelegate> headerProviders 
-        = new HashMap<Class<?>, HeaderDelegate>();    
+    protected Map<Class<?>, HeaderDelegate<?>> headerProviders 
+        = new HashMap<Class<?>, HeaderDelegate<?>>();    
 
     public RuntimeDelegateImpl() {
         headerProviders.put(MediaType.class, new MediaTypeHeaderProvider());
@@ -70,7 +70,7 @@ public class RuntimeDelegateImpl extends
     @SuppressWarnings("unchecked")
     @Override
     public <T> HeaderDelegate<T> createHeaderDelegate(Class<T> type) {
-        return headerProviders.get(type);
+        return (HeaderDelegate<T>)headerProviders.get(type);
     }
 
 

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/UriBuilderImpl.java Mon Jan  9 20:07:20 2012
@@ -323,7 +323,7 @@ public class UriBuilderImpl extends UriB
     }
 
     @Override
-    public UriBuilder path(Class resource) throws IllegalArgumentException {
+    public UriBuilder path(@SuppressWarnings("rawtypes") Class resource) throws IllegalArgumentException {
         if (resource == null) {
             throw new IllegalArgumentException("resource is null");
         }
@@ -338,7 +338,8 @@ public class UriBuilderImpl extends UriB
     }
 
     @Override
-    public UriBuilder path(Class resource, String method) throws IllegalArgumentException {
+    public UriBuilder path(@SuppressWarnings("rawtypes") Class resource, String method) 
+        throws IllegalArgumentException {
         if (resource == null) {
             throw new IllegalArgumentException("resource is null");
         }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalContextResolver.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalContextResolver.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalContextResolver.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalContextResolver.java Mon Jan  9 20:07:20 2012
@@ -21,11 +21,11 @@ package org.apache.cxf.jaxrs.impl.tl;
 
 import javax.ws.rs.ext.ContextResolver;
 
-public class ThreadLocalContextResolver extends AbstractThreadLocalProxy<ContextResolver> 
-    implements ContextResolver {
+public class ThreadLocalContextResolver<T> 
+    extends AbstractThreadLocalProxy<ContextResolver<T>> 
+    implements ContextResolver<T> {
 
-    @SuppressWarnings("unchecked")
-    public Object getContext(Class type) {
+    public T getContext(Class<?> type) {
         return get() != null ? get().getContext(type) : null;
     }
 

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalSearchContext.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalSearchContext.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalSearchContext.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/impl/tl/ThreadLocalSearchContext.java Mon Jan  9 20:07:20 2012
@@ -26,8 +26,7 @@ import org.apache.cxf.jaxrs.ext.search.S
 public class ThreadLocalSearchContext extends AbstractThreadLocalProxy<SearchContext> 
     implements SearchContext {
 
-    @SuppressWarnings("unchecked")
-    public SearchCondition getCondition(Class cls) {
+    public <T> SearchCondition<T> getCondition(Class<T> cls) {
         return get().getCondition(cls);
     }
 

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/interceptor/JAXRSOutInterceptor.java Mon Jan  9 20:07:20 2012
@@ -35,6 +35,7 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.GenericEntity;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
@@ -216,7 +217,7 @@ public class JAXRSOutInterceptor extends
         
         Annotation[] annotations = invoked != null ? invoked.getAnnotations() : new Annotation[]{};
         
-        MessageBodyWriter writer = null;
+        MessageBodyWriter<?> writer = null;
         MediaType responseType = null;
         for (MediaType type : availableContentTypes) { 
             writer = ProviderFactory.getInstance(message)
@@ -244,7 +245,7 @@ public class JAXRSOutInterceptor extends
             }
             message.put(Message.CONTENT_TYPE, responseType.toString());
             
-            long size = writer.getSize(entity, targetType, genericType, annotations, responseType);
+            long size = getSize(writer, entity, targetType, genericType, annotations, responseType);
             if (size > 0) {
                 LOG.fine("Setting ContentLength to " + size + " as requested by " 
                          + writer.getClass().getName());
@@ -254,11 +255,11 @@ public class JAXRSOutInterceptor extends
                 LOG.fine("Response EntityProvider is: " + writer.getClass().getName());
             }
             try {
-                writer.writeTo(entity, targetType, genericType, 
-                               annotations, 
-                               responseType, 
-                               responseHeaders, 
-                               message.getContent(OutputStream.class));
+                writeTo(writer, entity, targetType, genericType, 
+                        annotations, 
+                        responseType, 
+                        responseHeaders, 
+                        message.getContent(OutputStream.class));
                 
                 if (isResponseRedirected(message)) {
                     return;
@@ -283,6 +284,31 @@ public class JAXRSOutInterceptor extends
         }
     }
     
+    //CHECKSTYLE:OFF
+    private static <T> void writeTo(MessageBodyWriter<?> mwriter, 
+                                    T entity,
+                                    Class<?> type, Type genericType,
+                                    Annotation[] annotations, 
+                                    MediaType mediaType,
+                                    MultivaluedMap<String, Object> httpHeaders, 
+                                    OutputStream entityStream) 
+        throws WebApplicationException, IOException {
+        @SuppressWarnings("unchecked")
+        MessageBodyWriter<T> writer = (MessageBodyWriter<T>)mwriter;
+        writer.writeTo(entity, type, genericType, annotations, mediaType,
+                           httpHeaders, entityStream);
+    }
+
+    private static <T> long getSize(MessageBodyWriter<?> mwriter, T entity, 
+                                    Class<?> targetType, 
+                                    Type genericType,
+                                    Annotation[] annotations, MediaType responseType) {
+        @SuppressWarnings("unchecked")
+        MessageBodyWriter<T> writer = (MessageBodyWriter<T>)mwriter;
+        return writer.getSize(entity, targetType, genericType, annotations, responseType);
+    }
+    //CHECKSTYLE:ON
+
     private boolean isResponseNull(Object o) {
         return o == null || GenericEntity.class.isAssignableFrom(o.getClass()) 
                             && ((GenericEntity<?>)o).getEntity() == null; 
@@ -292,7 +318,7 @@ public class JAXRSOutInterceptor extends
         return GenericEntity.class.isAssignableFrom(o.getClass()) ? ((GenericEntity<?>)o).getEntity() : o; 
     }
     
-    private boolean checkBufferingMode(Message m, MessageBodyWriter w, boolean firstTry) {
+    private boolean checkBufferingMode(Message m, MessageBodyWriter<?> w, boolean firstTry) {
         if (!firstTry) {
             return false;
         }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/AbstractResourceInfo.java Mon Jan  9 20:07:20 2012
@@ -41,9 +41,9 @@ public abstract class AbstractResourceIn
     private static Map<Class<?>, List<Field>> contextFields;
     private static Map<Class<?>, List<Field>> resourceFields;
     private static Map<Class<?>, Map<Class<?>, Method>> contextMethods;
-    private static Map<Class<?>, Map<Field, ThreadLocalProxy>> fieldProxyMap;
-    private static Map<Class<?>, Map<Field, ThreadLocalProxy>> resourceProxyMap;
-    private static Map<Class<?>, Map<Method, ThreadLocalProxy>> setterProxyMap;
+    private static Map<Class<?>, Map<Field, ThreadLocalProxy<?>>> fieldProxyMap;
+    private static Map<Class<?>, Map<Field, ThreadLocalProxy<?>>> resourceProxyMap;
+    private static Map<Class<?>, Map<Method, ThreadLocalProxy<?>>> setterProxyMap;
     
     protected boolean root;
     protected Class<?> resourceClass;
@@ -98,9 +98,9 @@ public abstract class AbstractResourceIn
         findContextFields(cls.getSuperclass());
     }
     
-    private <T> Map<Class<?>, Map<T, ThreadLocalProxy>> getProxyMap(Class<T> keyClass,
-        Map<Class<?>, Map<T, ThreadLocalProxy>> map) {
-        return map == null ? new HashMap<Class<?>, Map<T, ThreadLocalProxy>>() : map;
+    private <T> Map<Class<?>, Map<T, ThreadLocalProxy<?>>> getProxyMap(Class<T> keyClass,
+        Map<Class<?>, Map<T, ThreadLocalProxy<?>>> map) {
+        return map == null ? new HashMap<Class<?>, Map<T, ThreadLocalProxy<?>>>() : map;
     }
     
     private void findContextSetterMethods(Class<?> cls) {
@@ -166,15 +166,15 @@ public abstract class AbstractResourceIn
         return getList(resourceFields);
     }
     
-    public ThreadLocalProxy getContextFieldProxy(Field f) {
+    public ThreadLocalProxy<?> getContextFieldProxy(Field f) {
         return getProxy(fieldProxyMap, f);
     }
     
-    public ThreadLocalProxy getResourceFieldProxy(Field f) {
+    public ThreadLocalProxy<?> getResourceFieldProxy(Field f) {
         return getProxy(resourceProxyMap, f);
     }
     
-    public ThreadLocalProxy getContextSetterProxy(Method m) {
+    public ThreadLocalProxy<?> getContextSetterProxy(Method m) {
         return getProxy(setterProxyMap, m);
     }
     
@@ -186,12 +186,12 @@ public abstract class AbstractResourceIn
         clearProxies(setterProxyMap);
     }
     
-    private <T> void clearProxies(Map<Class<?>, Map<T, ThreadLocalProxy>> tlps) {
-        Map<T, ThreadLocalProxy> proxies = tlps == null ? null : tlps.get(getServiceClass());
+    private <T> void clearProxies(Map<Class<?>, Map<T, ThreadLocalProxy<?>>> tlps) {
+        Map<T, ThreadLocalProxy<?>> proxies = tlps == null ? null : tlps.get(getServiceClass());
         if (proxies == null) {
             return;
         }
-        for (ThreadLocalProxy tlp : proxies.values()) {
+        for (ThreadLocalProxy<?> tlp : proxies.values()) {
             if (tlp != null) {
                 tlp.remove();
             }
@@ -235,10 +235,14 @@ public abstract class AbstractResourceIn
         return ret;
     }
     
-    private <T> ThreadLocalProxy getProxy(Map<Class<?>, Map<T, ThreadLocalProxy>> proxies, T key) {
+    private <T> ThreadLocalProxy<?> getProxy(Map<Class<?>, Map<T, ThreadLocalProxy<?>>> proxies,
+                                             T key) {
         
-        Map<T, ThreadLocalProxy> theMap = proxies == null ? null : proxies.get(getServiceClass());
-        
-        return theMap != null ? theMap.get(key) : null;
+        Map<?, ThreadLocalProxy<?>> theMap = proxies == null ? null : proxies.get(getServiceClass());
+        ThreadLocalProxy<?> ret = null;
+        if (theMap != null) {
+            ret = theMap.get(key);
+        }
+        return ret;
     }
 }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ProviderInfo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ProviderInfo.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ProviderInfo.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/ProviderInfo.java Mon Jan  9 20:07:20 2012
@@ -41,7 +41,7 @@ public class ProviderInfo<T> extends Abs
         if (!(obj instanceof ProviderInfo)) {
             return false;
         }
-        return provider.equals(((ProviderInfo)obj).getProvider());
+        return provider.equals(((ProviderInfo<?>)obj).getProvider());
     }
 
     public int hashCode() {

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java Mon Jan  9 20:07:20 2012
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.jaxrs.provider;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PrintWriter;
@@ -39,6 +40,7 @@ import java.util.logging.Logger;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.ext.ContextResolver;
 import javax.ws.rs.ext.MessageBodyReader;
@@ -75,8 +77,8 @@ import org.apache.cxf.phase.PhaseInterce
 import org.apache.cxf.staxutils.DepthXMLStreamReader;
 import org.apache.cxf.staxutils.transform.TransformUtils;
 
-public abstract class AbstractJAXBProvider extends AbstractConfigurableProvider
-    implements MessageBodyReader<Object>, MessageBodyWriter<Object> {
+public abstract class AbstractJAXBProvider<T> extends AbstractConfigurableProvider
+    implements MessageBodyReader<T>, MessageBodyWriter<T> {
     
     protected static final ResourceBundle BUNDLE = BundleUtils.getBundle(AbstractJAXBProvider.class);
 
@@ -182,7 +184,7 @@ public abstract class AbstractJAXBProvid
         }
     }
     
-    protected <T> T getStaxHandlerFromCurrentMessage(Class<T> staxCls) {
+    protected <X> X getStaxHandlerFromCurrentMessage(Class<X> staxCls) {
         Message m = PhaseInterceptorChain.getCurrentMessage();
         if (m != null) {
             return staxCls.cast(m.getContent(staxCls));
@@ -194,7 +196,7 @@ public abstract class AbstractJAXBProvid
         return cls.getAnnotation(XmlRootElement.class) != null;
     }
     
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     protected Object convertToJaxbElementIfNeeded(Object obj, Class<?> cls, Type genericType) 
         throws Exception {
         
@@ -210,7 +212,7 @@ public abstract class AbstractJAXBProvid
         } else if (marshalAsJaxbElement || asJaxbElement) {
             name = getJaxbQName(cls, genericType, obj, false);
         }
-        return name != null ? new JAXBElement(name, cls, null, obj) : obj;
+        return name != null ? new JAXBElement<Object>(name, (Class)cls, null, obj) : obj;
     }
     
     public void setCollectionWrapperName(String wName) {
@@ -236,7 +238,15 @@ public abstract class AbstractJAXBProvid
         
         return marshalAsJaxbElement || isSupported(type, genericType, anns);
     }
-    
+    public void writeTo(T t, Type genericType, Annotation annotations[], 
+                 MediaType mediaType, 
+                 MultivaluedMap<String, Object> httpHeaders,
+                 OutputStream entityStream) throws IOException, WebApplicationException {
+        @SuppressWarnings("unchecked")
+        Class<T> type = (Class<T>)t.getClass();
+        writeTo(t, type, genericType, annotations, mediaType, httpHeaders, entityStream);
+    }
+
     protected JAXBContext getCollectionContext(Class<?> type) throws JAXBException {
         synchronized (collectionContextClasses) {
             if (!collectionContextClasses.contains(type)) {
@@ -345,7 +355,7 @@ public abstract class AbstractJAXBProvid
         schema = s;    
     }
     
-    public long getSize(Object o, Class<?> type, Type genericType, Annotation[] annotations, MediaType mt) {
+    public long getSize(T o, Class<?> type, Type genericType, Annotation[] annotations, MediaType mt) {
         return -1;
     }
 

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AtomPojoProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AtomPojoProvider.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AtomPojoProvider.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AtomPojoProvider.java Mon Jan  9 20:07:20 2012
@@ -68,13 +68,13 @@ import org.apache.cxf.jaxrs.utils.Inject
 @Produces({"application/atom+xml", "application/atom+xml;type=feed", "application/atom+xml;type=entry" })
 @Consumes({"application/atom+xml", "application/atom+xml;type=feed", "application/atom+xml;type=entry" })
 @Provider
-public class AtomPojoProvider extends AbstractConfigurableProvider
-    implements MessageBodyWriter<Object>, MessageBodyReader<Object> {
+public class AtomPojoProvider<T> extends AbstractConfigurableProvider
+    implements MessageBodyWriter<T>, MessageBodyReader<T> {
     
     private static final Logger LOG = LogUtils.getL7dLogger(AtomPojoProvider.class);
     private static final Abdera ATOM_ENGINE = new Abdera();
     
-    private JAXBElementProvider jaxbProvider = new JAXBElementProvider();
+    private JAXBElementProvider<T> jaxbProvider = new JAXBElementProvider<T>();
     private Map<String, String> collectionGetters = Collections.emptyMap();
     private Map<String, String> collectionSetters = Collections.emptyMap();
     private Map<String, AtomElementWriter<?, ?>> atomWriters = Collections.emptyMap();
@@ -109,7 +109,7 @@ public class AtomPojoProvider extends Ab
         }
     }
     
-    public long getSize(Object t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mt) {
+    public long getSize(T t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mt) {
         return -1;
     }
     
@@ -125,7 +125,7 @@ public class AtomPojoProvider extends Ab
         return !Feed.class.isAssignableFrom(type) && !Entry.class.isAssignableFrom(type);
     }
 
-    public void writeTo(Object o, Class<?> clazz, Type genericType, Annotation[] annotations, 
+    public void writeTo(T o, Class<?> clazz, Type genericType, Annotation[] annotations, 
                         MediaType mt, MultivaluedMap<String, Object> headers, OutputStream os)
         throws IOException {
         boolean isFeed = isFeedRequested(mt);        
@@ -143,7 +143,9 @@ public class AtomPojoProvider extends Ab
             if (isFeed && !isCollection) {
                 atomElement = createFeedFromCollectionWrapper(o);
             } else if (!isFeed && !isCollection) {
-                atomElement = createEntryFromObject(o, clazz);
+                @SuppressWarnings("unchecked")
+                Class<? extends T> cls = (Class<? extends T>)clazz;
+                atomElement = createEntryFromObject(o, cls);
             }
         } catch (Exception ex) {
             throw new WebApplicationException(ex);
@@ -213,20 +215,24 @@ public class AtomPojoProvider extends Ab
     }
     
     @SuppressWarnings("unchecked")
-    protected boolean buildFeed(Feed feed, Object o) {
+    protected <X> boolean buildFeed(Feed feed, X o) {
         AtomElementWriter<?, ?> builder = atomWriters.get(o.getClass().getName());
         if (builder != null) {
-            ((AtomElementWriter)builder).writeTo(feed, o);
+            ((AtomElementWriter<Feed, X>)builder).writeTo(feed, o);
             return true;
         }
         return false;
     }
     
-    protected void setFeedFromCollection(Factory factory, Feed feed, Object wrapper, Object collection,
-        Class<?> collectionCls, Type collectionType, boolean writerUsed) throws Exception {
+    protected <X> void setFeedFromCollection(Factory factory, Feed feed, X wrapper, 
+                                             Object collection,
+                                             Class<?> collectionCls, 
+                                             Type collectionType, 
+                                             boolean writerUsed) throws Exception {
         
         Object[] arr = collectionCls.isArray() ? (Object[])collection : ((Collection<?>)collection).toArray();
-        Class<?> memberClass = InjectionUtils.getActualType(collectionType);
+        @SuppressWarnings("unchecked")
+        Class<? extends X> memberClass = (Class<? extends X>)InjectionUtils.getActualType(collectionType);
         
         for (Object o : arr) {
             Entry entry = createEntryFromObject(o, memberClass);
@@ -238,16 +244,17 @@ public class AtomPojoProvider extends Ab
     }
     
     @SuppressWarnings("unchecked")
-    protected void setFeedProperties(Factory factory, Feed feed, Object wrapper, Object collection, 
-                                     Class<?> collectionCls, Type collectionType) {
+    protected <X> void setFeedProperties(Factory factory, Feed feed, X wrapper, Object collection, 
+                                         Class<?> collectionCls, Type collectionType) {
         
-        AbstractAtomElementBuilder<?> builder = atomBuilders.get(wrapper.getClass().getName());
+        AbstractAtomElementBuilder<X> builder 
+            = (AbstractAtomElementBuilder<X>)atomBuilders.get(wrapper.getClass().getName());
         if (builder == null) {
             return;
         }
         setCommonElementProperties(factory, feed, builder, wrapper);
         
-        AbstractFeedBuilder theBuilder = (AbstractFeedBuilder)builder;
+        AbstractFeedBuilder<X> theBuilder = (AbstractFeedBuilder<X>)builder;
         
         // the hierarchy is a bit broken in that we can not set author/title.etc on some
         // common Feed/Entry super type
@@ -309,7 +316,7 @@ public class AtomPojoProvider extends Ab
     
     
     
-    protected Entry createEntryFromObject(Object o, Class<?> cls) throws Exception {
+    protected <X> Entry createEntryFromObject(X o, Class<? extends X> cls) throws Exception {
         
         Factory factory = Abdera.getNewFactory();
         Entry entry = factory.getAbdera().newEntry();
@@ -350,16 +357,18 @@ public class AtomPojoProvider extends Ab
         
     }
     
-    @SuppressWarnings("unchecked")
-    protected void setEntryProperties(Factory factory, Entry entry, Object o, Class<?> cls) {
-        AbstractAtomElementBuilder<?> builder = atomBuilders.get(o.getClass().getName());
+    protected <X> void setEntryProperties(Factory factory, Entry entry, 
+                                          X o, Class<? extends X> cls) {
+        @SuppressWarnings("unchecked")
+            AbstractAtomElementBuilder<X> builder 
+            = (AbstractAtomElementBuilder<X>)atomBuilders.get(o.getClass().getName());
         if (builder == null) {
             return;
         }
         
         setCommonElementProperties(factory, entry, builder, o);
         
-        AbstractEntryBuilder theBuilder = (AbstractEntryBuilder)builder;
+        AbstractEntryBuilder<X> theBuilder = (AbstractEntryBuilder<X>)builder;
         String author = theBuilder.getAuthor(o);
         if (author != null) {
             entry.addAuthor(author);
@@ -414,10 +423,9 @@ public class AtomPojoProvider extends Ab
         
     }
 
-    @SuppressWarnings("unchecked")
-    private void setCommonElementProperties(Factory factory, ExtensibleElement element, 
-                                            AbstractAtomElementBuilder builder,
-                                            Object o) {
+    private <X> void setCommonElementProperties(Factory factory, ExtensibleElement element, 
+                                            AbstractAtomElementBuilder<X> builder,
+                                            X o) {
         String baseUri = builder.getBaseUri(o);
         if (baseUri != null) {
             element.setBaseUri(baseUri);
@@ -459,8 +467,8 @@ public class AtomPojoProvider extends Ab
         return true;
     }
 
-    public Object readFrom(Class<Object> cls, Type type, Annotation[] anns, MediaType mt, 
-                           MultivaluedMap<String, String> headers, InputStream is) 
+    public T readFrom(Class<T> cls, Type type, Annotation[] anns, MediaType mt, 
+                      MultivaluedMap<String, String> headers, InputStream is) 
         throws IOException, WebApplicationException {
         boolean isFeed = isFeedRequested(mt);
         
@@ -474,8 +482,8 @@ public class AtomPojoProvider extends Ab
     }
     
     @SuppressWarnings("unchecked")
-    private Object readFromFeed(Class<Object> cls, MediaType mt, 
-                                MultivaluedMap<String, String> headers, InputStream is) 
+    private T readFromFeed(Class<T> cls, MediaType mt, 
+                           MultivaluedMap<String, String> headers, InputStream is) 
         throws IOException {
         
         AtomFeedProvider p = new AtomFeedProvider();
@@ -483,13 +491,14 @@ public class AtomPojoProvider extends Ab
         
         AtomElementReader<?, ?> reader = atomReaders.get(cls.getName());
         if (reader != null) {
-            return ((AtomElementReader)reader).readFrom(feed);
+            return ((AtomElementReader<Feed, T>)reader).readFrom(feed);
         }
-        Object instance = null;
+        T instance = null;
         try {
             String methodName = getCollectionMethod(cls, false);
             Method m = cls.getMethod(methodName, new Class[]{List.class});
-            Class<?> realCls = InjectionUtils.getActualType(m.getGenericParameterTypes()[0]);
+            Class<Object> realCls 
+                = (Class<Object>)InjectionUtils.getActualType(m.getGenericParameterTypes()[0]);
             List<Object> objects = new ArrayList<Object>();
             for (Entry e : feed.getEntries()) {
                 objects.add(readFromEntry(e, realCls, mt, headers, is));
@@ -504,18 +513,18 @@ public class AtomPojoProvider extends Ab
     }
     
     @SuppressWarnings("unchecked")
-    private Object readFromEntry(Entry entry, Class<?> cls, MediaType mt, 
-                                MultivaluedMap<String, String> headers, InputStream is) 
+    private <X> X readFromEntry(Entry entry, Class<X> cls, MediaType mt, 
+                            MultivaluedMap<String, String> headers, InputStream is) 
         throws IOException {
         
         AtomElementReader<?, ?> reader = atomReaders.get(cls.getName());
         if (reader != null) {
-            return ((AtomElementReader)reader).readFrom(entry);
+            return ((AtomElementReader<Entry, X>)reader).readFrom(entry);
         }
         try {
             Unmarshaller um = 
                 jaxbProvider.getJAXBContext(cls, cls).createUnmarshaller();
-            return um.unmarshal(new StringReader(entry.getContent()));
+            return cls.cast(um.unmarshal(new StringReader(entry.getContent())));
         } catch (Exception ex) {
             reportError("Object of type " + cls.getName() + " can not be deserialized from Entry", ex);
         }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/BinaryDataProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/BinaryDataProvider.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/BinaryDataProvider.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/BinaryDataProvider.java Mon Jan  9 20:07:20 2012
@@ -46,8 +46,8 @@ import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.PhaseInterceptorChain;
 
-public class BinaryDataProvider extends AbstractConfigurableProvider 
-    implements MessageBodyReader<Object>, MessageBodyWriter<Object> {
+public class BinaryDataProvider<T> extends AbstractConfigurableProvider 
+    implements MessageBodyReader<T>, MessageBodyWriter<T> {
     
     private static final String HTTP_RANGE_PROPERTY = "http.range.support";
     
@@ -59,22 +59,22 @@ public class BinaryDataProvider extends 
                || Reader.class.isAssignableFrom(type);
     }
 
-    public Object readFrom(Class<Object> clazz, Type genericType, Annotation[] annotations, MediaType type, 
+    public T readFrom(Class<T> clazz, Type genericType, Annotation[] annotations, MediaType type, 
                            MultivaluedMap<String, String> headers, InputStream is)
         throws IOException {
         if (InputStream.class.isAssignableFrom(clazz)) {
-            return is;
+            return clazz.cast(is);
         }
         if (Reader.class.isAssignableFrom(clazz)) {
-            return new InputStreamReader(is, getEncoding(type));
+            return clazz.cast(new InputStreamReader(is, getEncoding(type)));
         }
         if (byte[].class.isAssignableFrom(clazz)) {
-            return IOUtils.readBytesFromStream(is);
+            return clazz.cast(IOUtils.readBytesFromStream(is));
         }
         throw new IOException("Unrecognized class");
     }
 
-    public long getSize(Object t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mt) {
+    public long getSize(T t, Class<?> type, Type genericType, Annotation[] annotations, MediaType mt) {
         // TODO: if it's a range request, then we should probably always return -1 and set 
         // Content-Length and Content-Range in handleRangeRequest
         if (byte[].class.isAssignableFrom(t.getClass())) {
@@ -91,7 +91,7 @@ public class BinaryDataProvider extends 
             || StreamingOutput.class.isAssignableFrom(type);
     }
 
-    public void writeTo(Object o, Class<?> clazz, Type genericType, Annotation[] annotations, 
+    public void writeTo(T o, Class<?> clazz, Type genericType, Annotation[] annotations, 
                         MediaType type, MultivaluedMap<String, Object> headers, OutputStream os)
         throws IOException {
         

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/FormEncodingProvider.java Mon Jan  9 20:07:20 2012
@@ -51,8 +51,8 @@ import org.apache.cxf.phase.PhaseInterce
 @Produces({"application/x-www-form-urlencoded", "multipart/form-data" })
 @Consumes({"application/x-www-form-urlencoded", "multipart/form-data" })
 @Provider
-public class FormEncodingProvider implements 
-    MessageBodyReader<Object>, MessageBodyWriter<Object> {
+public class FormEncodingProvider<T> implements 
+    MessageBodyReader<T>, MessageBodyWriter<T> {
         
     private FormValidator validator;
     @Context private MessageContext mc;
@@ -87,8 +87,8 @@ public class FormEncodingProvider implem
         return isSupported(type, genericType, annotations, mt);
     }
 
-    public Object readFrom(
-        Class<Object> clazz, Type genericType, Annotation[] annotations, MediaType mt, 
+    public T readFrom(
+        Class<T> clazz, Type genericType, Annotation[] annotations, MediaType mt, 
         MultivaluedMap<String, String> headers, InputStream is) 
         throws IOException {
         if (is == null) {
@@ -98,9 +98,9 @@ public class FormEncodingProvider implem
             if (mt.isCompatible(MediaType.MULTIPART_FORM_DATA_TYPE)) {
                 MultipartBody body = AttachmentUtils.getMultipartBody(mc);
                 if (MultipartBody.class.isAssignableFrom(clazz)) {
-                    return body;
+                    return clazz.cast(body);
                 } else if (Attachment.class.isAssignableFrom(clazz)) {
-                    return body.getRootAttachment();
+                    return clazz.cast(body.getRootAttachment());
                 }  
             }
             
@@ -138,8 +138,8 @@ public class FormEncodingProvider implem
         return (MultivaluedMap<String, String>)clazz.newInstance();
     }
     
-    private Object getFormObject(Class<?> clazz, MultivaluedMap<String, String> params) {
-        return Form.class.isAssignableFrom(clazz) ? new Form(params) : params;
+    private T getFormObject(Class<T> clazz, MultivaluedMap<String, String> params) {
+        return clazz.cast(Form.class.isAssignableFrom(clazz) ? new Form(params) : params);
     }
     
     /**
@@ -173,7 +173,7 @@ public class FormEncodingProvider implem
         }
     }
 
-    public long getSize(Object t, Class<?> type, 
+    public long getSize(T t, Class<?> type, 
                         Type genericType, Annotation[] annotations, 
                         MediaType mediaType) {
         return -1;
@@ -193,7 +193,7 @@ public class FormEncodingProvider implem
     }
     
     @SuppressWarnings("unchecked")
-    public void writeTo(Object obj, Class<?> c, Type t, Annotation[] anns, 
+    public void writeTo(T obj, Class<?> c, Type t, Annotation[] anns, 
                         MediaType mt, MultivaluedMap<String, Object> headers, OutputStream os) 
         throws IOException, WebApplicationException {
         

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXBElementProvider.java Mon Jan  9 20:07:20 2012
@@ -74,7 +74,7 @@ import org.apache.cxf.staxutils.transfor
 @Produces({"application/xml", "application/*+xml", "text/xml" })
 @Consumes({"application/xml", "application/*+xml", "text/xml" })
 @Provider
-public class JAXBElementProvider extends AbstractJAXBProvider  {
+public class JAXBElementProvider<T> extends AbstractJAXBProvider<T>  {
     private static final String XML_PI_START = "<?xml version=\"1.0\" encoding=\"";
     private static final String NS_MAPPER_PROPERTY = "com.sun.xml.bind.namespacePrefixMapper";
     private static final String NS_MAPPER_PROPERTY_INT = "com.sun.xml.internal.bind.namespacePrefixMapper";
@@ -147,7 +147,7 @@ public class JAXBElementProvider extends
         mProperties.put(Marshaller.JAXB_SCHEMA_LOCATION, schemaLocation);
     }
     
-    public Object readFrom(Class<Object> type, Type genericType, Annotation[] anns, MediaType mt, 
+    public T readFrom(Class<T> type, Type genericType, Annotation[] anns, MediaType mt, 
         MultivaluedMap<String, String> headers, InputStream is) 
         throws IOException {
         try {
@@ -172,7 +172,7 @@ public class JAXBElementProvider extends
                 response = doUnmarshal(unmarshaller, type, is, mt);
             }
             if (response instanceof JAXBElement && !JAXBElement.class.isAssignableFrom(type)) {
-                response = ((JAXBElement)response).getValue();    
+                response = ((JAXBElement<?>)response).getValue();    
             }
             if (isCollection) {
                 response = ((CollectionWrapper)response).getCollectionOrArray(theType, type, 
@@ -180,7 +180,7 @@ public class JAXBElementProvider extends
             } else {
                 response = checkAdapter(response, type, anns, false);
             }
-            return response;
+            return type.cast(response);
             
         } catch (JAXBException e) {
             handleJAXBException(e, true);
@@ -242,7 +242,7 @@ public class JAXBElementProvider extends
         return unmarshaller.unmarshal(reader);
     }
     
-    public void writeTo(Object obj, Class<?> cls, Type genericType, Annotation[] anns,  
+    public void writeTo(T obj, Class<?> cls, Type genericType, Annotation[] anns,  
         MediaType m, MultivaluedMap<String, Object> headers, OutputStream os) 
         throws IOException {
         try {
@@ -273,16 +273,16 @@ public class JAXBElementProvider extends
         Class<?> actualClass = InjectionUtils.getActualType(genericType);
         actualClass = getActualType(actualClass, genericType, anns);
         
-        Collection c = originalCls.isArray() ? Arrays.asList((Object[]) collection) 
-                                             : (Collection) collection;
+        Collection<?> c = originalCls.isArray() ? Arrays.asList((Object[]) collection) 
+                                             : (Collection<?>) collection;
 
-        Iterator it = c.iterator();
+        Iterator<?> it = c.iterator();
         
         Object firstObj = it.hasNext() ? it.next() : null;
 
         QName qname = null;
         if (firstObj instanceof JAXBElement) {
-            JAXBElement el = (JAXBElement)firstObj;
+            JAXBElement<?> el = (JAXBElement<?>)firstObj;
             qname = el.getName();
             actualClass = el.getDeclaredType();
         } else {
@@ -338,7 +338,7 @@ public class JAXBElementProvider extends
                                            String ns) throws Exception {
         
         if (obj instanceof JAXBElement) {
-            obj = ((JAXBElement)obj).getValue();    
+            obj = ((JAXBElement<?>)obj).getValue();    
         } else {
             obj = convertToJaxbElementIfNeeded(obj, cls, genericType);
         }



Mime
View raw message