cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1229332 [2/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
Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXRSDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXRSDataBinding.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXRSDataBinding.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JAXRSDataBinding.java Mon Jan  9 20:07:20 2012
@@ -18,11 +18,13 @@
  */
 package org.apache.cxf.jaxrs.provider;
 
+import java.io.IOException;
 import java.lang.reflect.Method;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
+import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyReader;
@@ -52,18 +54,19 @@ public class JAXRSDataBinding extends Ab
     private static final Class<?> SUPPORTED_READER_FORMATS[] = new Class<?>[] {XMLStreamReader.class};
     private static final Class<?> SUPPORTED_WRITER_FORMATS[] = new Class<?>[] {XMLStreamWriter.class};
     
-    private MessageBodyReader xmlReader;
-    private MessageBodyWriter xmlWriter;
+    private MessageBodyReader<?> xmlReader;
+    private MessageBodyWriter<Object> xmlWriter;
     
+    @SuppressWarnings("unchecked")
     public void setProvider(Object provider) {
         if (!(provider instanceof MessageBodyWriter)) {
             throw new IllegalArgumentException(
                 "The provider must implement javax.ws.rs.ext.MessageBodyWriter");
         }
-        xmlWriter = (MessageBodyWriter)provider;
+        xmlWriter = (MessageBodyWriter<Object>)provider;
         
         if (provider instanceof MessageBodyReader) {
-            xmlReader = (MessageBodyReader)provider;
+            xmlReader = (MessageBodyReader<?>)provider;
         }
     }
     
@@ -107,19 +110,23 @@ public class JAXRSDataBinding extends Ab
         return new MetadataMap<String, String>(
             (Map<String, List<String>>)message.get(Message.PROTOCOL_HEADERS), true, true);
     }
+    @SuppressWarnings("unchecked")
+    private MultivaluedMap<String, Object> getWriteHeaders(Message message) {
+        return new MetadataMap<String, Object>(
+            (Map<String, List<Object>>)message.get(Message.PROTOCOL_HEADERS), true, true);
+    }
     
     private class MessageBodyDataWriter implements DataWriter<XMLStreamWriter> {
         
         public void write(Object obj, XMLStreamWriter output) {
             write(obj, null, output);
         }
-
-        @SuppressWarnings("unchecked")
+        
         public void write(Object obj, MessagePartInfo part, XMLStreamWriter output) {
             try {
                 Message message = PhaseInterceptorChain.getCurrentMessage();
                 Method method = getTargetMethod(message);
-                MultivaluedMap<String, String> headers = getHeaders(message);        
+                MultivaluedMap<String, Object> headers = getWriteHeaders(message);
                 xmlWriter.writeTo(obj, 
                                  method.getReturnType(), 
                                  method.getGenericReturnType(), 
@@ -156,22 +163,27 @@ public class JAXRSDataBinding extends Ab
             return doRead(part.getTypeClass(), input);
         }
 
-        public Object read(QName elementQName, XMLStreamReader input, Class type) {
+        public Object read(QName elementQName, XMLStreamReader input, Class<?> type) {
             return doRead(type, input);
         }
 
         
         @SuppressWarnings("unchecked")
-        private Object doRead(Class cls, XMLStreamReader input) {
+        private <T> T read(Class<T> cls) throws WebApplicationException, IOException {
+            Message message = PhaseInterceptorChain.getCurrentMessage();
+            Method method = getTargetMethod(message);
+            MessageBodyReader<T> reader = (MessageBodyReader<T>)xmlReader;
+
+            return reader.readFrom(cls, 
+                                      method.getGenericParameterTypes()[0], 
+                                      method.getParameterTypes()[0].getAnnotations(), 
+                                      MediaType.APPLICATION_ATOM_XML_TYPE,
+                                      getHeaders(message),             
+                                      null);
+        }
+        private Object doRead(Class<?> cls, XMLStreamReader input) {
             try {
-                Message message = PhaseInterceptorChain.getCurrentMessage();
-                Method method = getTargetMethod(message);
-                return xmlReader.readFrom(cls, 
-                                          method.getGenericParameterTypes()[0], 
-                                          method.getParameterTypes()[0].getAnnotations(), 
-                                          MediaType.APPLICATION_ATOM_XML_TYPE,
-                                          getHeaders(message),             
-                                          null);
+                return read(cls);
             } catch (Exception ex) {
                 return null;
             }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONProvider.java Mon Jan  9 20:07:20 2012
@@ -75,7 +75,7 @@ import org.codehaus.jettison.util.String
 @Produces("application/json")
 @Consumes("application/json")
 @Provider
-public class JSONProvider extends AbstractJAXBProvider  {
+public class JSONProvider<T> extends AbstractJAXBProvider<T>  {
     
     private static final String MAPPED_CONVENTION = "mapped";
     private static final String BADGER_FISH_CONVENTION = "badgerfish";
@@ -193,7 +193,7 @@ public class JSONProvider extends Abstra
         return super.isReadable(type, genericType, anns, mt) || Document.class.isAssignableFrom(type);    
     }
     
-    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 {
         
@@ -202,7 +202,7 @@ public class JSONProvider extends Abstra
             if (Document.class.isAssignableFrom(type)) {
                 W3CDOMStreamWriter writer = new W3CDOMStreamWriter();
                 copyReaderToWriter(createReader(type, realStream, false), writer);
-                return writer.getDocument();
+                return type.cast(writer.getDocument());
             }
             boolean isCollection = InjectionUtils.isSupportedCollectionOrArray(type);
             Class<?> theGenericType = isCollection ? InjectionUtils.getActualType(genericType) : type;
@@ -220,7 +220,7 @@ public class JSONProvider extends Abstra
                 response = unmarshaller.unmarshal(xsr);
             }
             if (response instanceof JAXBElement && !JAXBElement.class.isAssignableFrom(type)) {
-                response = ((JAXBElement)response).getValue();    
+                response = ((JAXBElement<?>)response).getValue();    
             }
             if (isCollection) {
                 response = ((CollectionWrapper)response).getCollectionOrArray(theType, type, 
@@ -228,7 +228,7 @@ public class JSONProvider extends Abstra
             } else {
                 response = checkAdapter(response, type, anns, false);
             }
-            return response;
+            return type.cast(response);
             
         } catch (JAXBException e) {
             handleJAXBException(e, true);
@@ -259,7 +259,7 @@ public class JSONProvider extends Abstra
         }
     }
     
-    protected InputStream getInputStream(Class<Object> cls, Type type, InputStream is) throws Exception {
+    protected InputStream getInputStream(Class<T> cls, Type type, InputStream is) throws Exception {
         if (unwrapped) {
             String rootName = getRootName(cls, type);
             InputStream isBefore = new ByteArrayInputStream(rootName.getBytes());
@@ -285,7 +285,7 @@ public class JSONProvider extends Abstra
                  
     }
     
-    protected String getRootName(Class<Object> cls, Type type) throws Exception {
+    protected String getRootName(Class<T> cls, Type type) throws Exception {
         String name = null;
         if (wrapperName != null) {
             name = wrapperName;
@@ -316,7 +316,7 @@ public class JSONProvider extends Abstra
             || Document.class.isAssignableFrom(type);
     }
     
-    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 {
         if (os == null) {
@@ -372,10 +372,10 @@ public class JSONProvider extends Abstra
         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;
 
@@ -384,7 +384,7 @@ public class JSONProvider extends Abstra
         if (!dropCollectionWrapperElement) {
             QName qname = null;
             if (firstObj instanceof JAXBElement) {
-                JAXBElement el = (JAXBElement)firstObj;
+                JAXBElement<?> el = (JAXBElement<?>)firstObj;
                 qname = el.getName();
                 actualClass = el.getDeclaredType();
             } else {
@@ -422,7 +422,7 @@ public class JSONProvider extends Abstra
     protected void marshalCollectionMember(Object obj, Class<?> cls, Type genericType,
                                            String enc, OutputStream os) throws Exception {
         if (obj instanceof JAXBElement) {
-            obj = ((JAXBElement)obj).getValue();    
+            obj = ((JAXBElement<?>)obj).getValue();    
         } else {
             obj = convertToJaxbElementIfNeeded(obj, cls, genericType);
         }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONUtils.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONUtils.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/JSONUtils.java Mon Jan  9 20:07:20 2012
@@ -177,7 +177,7 @@ public final class JSONUtils {
                     return namespaceMap.get(ns);
                 }
 
-                public Iterator getPrefixes(String ns) {
+                public Iterator<?> getPrefixes(String ns) {
                     String prefix = getPrefix(ns);
                     return prefix == null ? null : Collections.singletonList(prefix).iterator();
                 }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/MultipartProvider.java Mon Jan  9 20:07:20 2012
@@ -189,8 +189,7 @@ public class MultipartProvider extends A
         return actual != null && actual != Object.class ? actual : Attachment.class;
     }
     
-    @SuppressWarnings("unchecked")
-    private Object fromAttachment(Attachment multipart, Class<?> c, Type t, Annotation anns[]) 
+    private <T> Object fromAttachment(Attachment multipart, Class<T> c, Type t, Annotation anns[]) 
         throws IOException {
         if (DataHandler.class.isAssignableFrom(c)) {
             return multipart.getDataHandler();
@@ -206,12 +205,12 @@ public class MultipartProvider extends A
                        multipart.getDataHandler().getInputStream());
                 anns = new Annotation[]{};
             }
-            MessageBodyReader<Object> r = 
-                mc.getProviders().getMessageBodyReader((Class)c, t, anns, multipart.getContentType());
+            MessageBodyReader<T> r = 
+                mc.getProviders().getMessageBodyReader(c, t, anns, multipart.getContentType());
             if (r != null) {
                 InputStream is = multipart.getDataHandler().getInputStream();
                 is = decodeIfNeeded(multipart, is);
-                return r.readFrom((Class)c, t, anns, multipart.getContentType(), multipart.getHeaders(), 
+                return r.readFrom(c, t, anns, multipart.getContentType(), multipart.getHeaders(), 
                                   is);
             }
         }
@@ -266,7 +265,7 @@ public class MultipartProvider extends A
                 iter.hasNext();) {
                 Map.Entry<Object, Object> entry = iter.next();
                 Object value = entry.getValue();
-                Attachment handler = createDataHandler(value, value.getClass(), value.getClass(), 
+                Attachment handler = createDataHandler(value, value.getClass(), 
                                                        new Annotation[]{},
                                                        entry.getKey().toString(),
                                                        mt.toString(),
@@ -285,7 +284,7 @@ public class MultipartProvider extends A
                     return getAttachments(atts, rootMediaType);
                 }
                 Attachment handler = createDataHandler(obj,
-                                                       type, genericType, anns,
+                                                       genericType, anns,
                                                        rootMediaType, mt.toString(), 1);
                 return Collections.singletonList(handler);
             }
@@ -297,15 +296,26 @@ public class MultipartProvider extends A
         for (int i = 0; i < objects.size(); i++) {
             Object value = objects.get(i);
             Attachment handler = createDataHandler(value,
-                                           value.getClass(), value.getClass(), new Annotation[]{},
+                                           value.getClass(), new Annotation[]{},
                                            rootMediaType, rootMediaType, i);
             handlers.add(handler);
         }
         return handlers;
     }
     
-    private Attachment createDataHandler(Object obj, 
-                                         Class<?> cls, Type genericType,
+    private <T> Attachment createDataHandler(T obj, 
+                                             Type genericType,
+                                             Annotation[] anns,
+                                             String mimeType,
+                                             String mainMediaType,
+                                             int id) {
+        @SuppressWarnings("unchecked")
+        Class<T> cls = (Class<T>)obj.getClass();
+        return createDataHandler(obj, cls, genericType, anns, mimeType, mainMediaType, id);
+    }
+    private <T> Attachment createDataHandler(T obj, 
+                                         Class<T> cls, 
+                                         Type genericType,
                                          Annotation[] anns,
                                          String mimeType,
                                          String mainMediaType,
@@ -331,7 +341,7 @@ public class MultipartProvider extends A
             if (att.getObject() == null) {
                 return att;
             }
-            dh = getHandlerForObject(att.getObject(), att.getObject().getClass(), 
+            dh = getHandlerForObject(att.getObject(), 
                                      att.getObject().getClass(), new Annotation[]{}, 
                                      att.getContentType().toString(), id);
             return new Attachment(att.getContentId(), dh, att.getHeaders());
@@ -355,14 +365,13 @@ public class MultipartProvider extends A
         return id == 0 ? AttachmentUtil.BODY_ATTACHMENT_ID : Integer.toString(id);
     }
     
-    @SuppressWarnings("unchecked")
-    private DataHandler getHandlerForObject(Object obj, 
-                                            Class<?> cls, Type genericType,
+    private <T> DataHandler getHandlerForObject(T obj, 
+                                            Class<T> cls, Type genericType,
                                             Annotation[] anns,
                                             String mimeType, int id) {
         MediaType mt = MediaType.valueOf(mimeType);
-        MessageBodyWriter<Object> r = 
-            (MessageBodyWriter)mc.getProviders().getMessageBodyWriter(cls, genericType, anns, mt);
+        MessageBodyWriter<T> r = 
+            mc.getProviders().getMessageBodyWriter(cls, genericType, anns, mt);
         if (r == null) {
             org.apache.cxf.common.i18n.Message message = 
                 new org.apache.cxf.common.i18n.Message("NO_MSG_WRITER",
@@ -371,7 +380,15 @@ public class MultipartProvider extends A
             LOG.severe(message.toString());
             throw new WebApplicationException(500);
         }
-        return new MessageBodyWriterDataHandler(r, obj, cls, genericType, anns, mt);
+        return new MessageBodyWriterDataHandler<T>(r, obj, cls, genericType, anns, mt);
+    }
+    private <T> DataHandler getHandlerForObject(T obj, 
+                                            Type genericType,
+                                            Annotation[] anns,
+                                            String mimeType, int id) {
+        @SuppressWarnings("unchecked")
+        Class<T> cls = (Class<T>)obj.getClass();
+        return getHandlerForObject(obj, cls, genericType, anns, mimeType, id);
     }
     
     private DataHandler createInputStreamDH(InputStream is, String mimeType) {
@@ -397,16 +414,16 @@ public class MultipartProvider extends A
         return mimeType;
     }
     
-    private static class MessageBodyWriterDataHandler extends DataHandler {
-        private MessageBodyWriter<Object> writer;
-        private Object obj;
-        private Class<?> cls;
+    private static class MessageBodyWriterDataHandler<T> extends DataHandler {
+        private MessageBodyWriter<T> writer;
+        private T obj;
+        private Class<T> cls;
         private Type genericType;
         private Annotation[] anns;
         private MediaType contentType;
-        public MessageBodyWriterDataHandler(MessageBodyWriter<Object> writer,
-                                            Object obj,
-                                            Class<?> cls,
+        public MessageBodyWriterDataHandler(MessageBodyWriter<T> writer,
+                                            T obj,
+                                            Class<T> cls,
                                             Type genericType,
                                             Annotation[] anns,
                                             MediaType contentType) {

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProvider.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProvider.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/PrimitiveTextProvider.java Mon Jan  9 20:07:20 2012
@@ -34,8 +34,8 @@ import org.apache.cxf.jaxrs.model.Parame
 import org.apache.cxf.jaxrs.utils.HttpUtils;
 import org.apache.cxf.jaxrs.utils.InjectionUtils;
 
-public class PrimitiveTextProvider 
-    implements MessageBodyReader<Object>, MessageBodyWriter<Object> {
+public class PrimitiveTextProvider<T> 
+    implements MessageBodyReader<T>, MessageBodyWriter<T> {
 
     private static boolean isSupported(Class<?> type) { 
         return InjectionUtils.isPrimitive(type);
@@ -45,8 +45,8 @@ public class PrimitiveTextProvider 
         return isSupported(type);
     }
 
-    public Object readFrom(Class<Object> type, Type genType, Annotation[] anns, MediaType mt, 
-                           MultivaluedMap<String, String> headers, InputStream is) throws IOException {
+    public T readFrom(Class<T> type, Type genType, Annotation[] anns, MediaType mt, 
+                      MultivaluedMap<String, String> headers, InputStream is) throws IOException {
         
         return InjectionUtils.handleParameter(
                     IOUtils.toString(is, HttpUtils.getEncoding(mt, "UTF-8")), 
@@ -57,7 +57,7 @@ public class PrimitiveTextProvider 
         
     }
 
-    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;
     }
 
@@ -65,7 +65,7 @@ public class PrimitiveTextProvider 
         return isSupported(type);
     }
 
-    public void writeTo(Object obj, Class<?> type, Type genType, Annotation[] anns, 
+    public void writeTo(T obj, Class<?> type, Type genType, Annotation[] anns, 
                         MediaType mt, MultivaluedMap<String, Object> headers,
                         OutputStream os) throws IOException {
         String encoding = HttpUtils.getSetEncoding(mt, headers, "UTF-8");

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/ProviderFactory.java Mon Jan  9 20:07:20 2012
@@ -45,6 +45,7 @@ import org.apache.cxf.common.classloader
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.ClassHelper;
 import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.jaxrs.client.ResponseExceptionMapper;
 import org.apache.cxf.jaxrs.ext.ParameterHandler;
 import org.apache.cxf.jaxrs.ext.RequestHandler;
@@ -66,38 +67,38 @@ public final class ProviderFactory {
     private static final String JSON_PROVIDER_NAME = "org.apache.cxf.jaxrs.provider.JSONProvider";
     
     static {
-        SHARED_FACTORY.setProviders(new BinaryDataProvider(),
-                                    new SourceProvider(),
-                                    new FormEncodingProvider(),
-                                    new PrimitiveTextProvider(),
+        SHARED_FACTORY.setProviders(new BinaryDataProvider<Object>(),
+                                    new SourceProvider<Object>(),
+                                    new FormEncodingProvider<Object>(),
+                                    new PrimitiveTextProvider<Object>(),
                                     new MultipartProvider(),
                                     new WebApplicationExceptionMapper(),
                                     new WadlGenerator());
     }
     
-    private List<ProviderInfo<MessageBodyReader>> messageReaders = 
-        new ArrayList<ProviderInfo<MessageBodyReader>>();
-    private List<ProviderInfo<MessageBodyWriter>> messageWriters = 
-        new ArrayList<ProviderInfo<MessageBodyWriter>>();
-    private List<ProviderInfo<ContextResolver>> contextResolvers = 
-        new ArrayList<ProviderInfo<ContextResolver>>(1);
-    private List<ProviderInfo<ExceptionMapper>> exceptionMappers = 
-        new ArrayList<ProviderInfo<ExceptionMapper>>(1);
+    private List<ProviderInfo<MessageBodyReader<?>>> messageReaders = 
+        new ArrayList<ProviderInfo<MessageBodyReader<?>>>();
+    private List<ProviderInfo<MessageBodyWriter<?>>> messageWriters = 
+        new ArrayList<ProviderInfo<MessageBodyWriter<?>>>();
+    private List<ProviderInfo<ContextResolver<?>>> contextResolvers = 
+        new ArrayList<ProviderInfo<ContextResolver<?>>>(1);
+    private List<ProviderInfo<ExceptionMapper<?>>> exceptionMappers = 
+        new ArrayList<ProviderInfo<ExceptionMapper<?>>>(1);
     private List<ProviderInfo<RequestHandler>> requestHandlers = 
         new ArrayList<ProviderInfo<RequestHandler>>(1);
     private List<ProviderInfo<ResponseHandler>> responseHandlers = 
         new ArrayList<ProviderInfo<ResponseHandler>>(1);
-    private List<ProviderInfo<ParameterHandler>> paramHandlers = 
-        new ArrayList<ProviderInfo<ParameterHandler>>(1);
-    private List<ProviderInfo<ResponseExceptionMapper>> responseExceptionMappers = 
-        new ArrayList<ProviderInfo<ResponseExceptionMapper>>(1);
+    private List<ProviderInfo<ParameterHandler<?>>> paramHandlers = 
+        new ArrayList<ProviderInfo<ParameterHandler<?>>>(1);
+    private List<ProviderInfo<ResponseExceptionMapper<?>>> responseExceptionMappers = 
+        new ArrayList<ProviderInfo<ResponseExceptionMapper<?>>>(1);
     private RequestPreprocessor requestPreprocessor;
     private ProviderInfo<Application> application;
     
-    private List<ProviderInfo<MessageBodyReader>> jaxbReaders = 
-        new ArrayList<ProviderInfo<MessageBodyReader>>();
-    private List<ProviderInfo<MessageBodyWriter>> jaxbWriters = 
-        new ArrayList<ProviderInfo<MessageBodyWriter>>();
+    private List<ProviderInfo<MessageBodyReader<?>>> jaxbReaders = 
+        new ArrayList<ProviderInfo<MessageBodyReader<?>>>();
+    private List<ProviderInfo<MessageBodyWriter<?>>> jaxbWriters = 
+        new ArrayList<ProviderInfo<MessageBodyWriter<?>>>();
     
     private ProviderFactory() {
         initJaxbProviders();
@@ -110,13 +111,13 @@ public final class ProviderFactory {
     private void initJaxbProviders() {
         Object jaxbProvider = createProvider(JAXB_PROVIDER_NAME);
         if (jaxbProvider != null) {
-            jaxbReaders.add(new ProviderInfo<MessageBodyReader>((MessageBodyReader)jaxbProvider));
-            jaxbWriters.add(new ProviderInfo<MessageBodyWriter>((MessageBodyWriter)jaxbProvider));
+            jaxbReaders.add(new ProviderInfo<MessageBodyReader<?>>((MessageBodyReader<?>)jaxbProvider));
+            jaxbWriters.add(new ProviderInfo<MessageBodyWriter<?>>((MessageBodyWriter<?>)jaxbProvider));
         }
         Object jsonProvider = createProvider(JSON_PROVIDER_NAME);
         if (jsonProvider != null) {
-            jaxbReaders.add(new ProviderInfo<MessageBodyReader>((MessageBodyReader)jsonProvider));
-            jaxbWriters.add(new ProviderInfo<MessageBodyWriter>((MessageBodyWriter)jsonProvider));
+            jaxbReaders.add(new ProviderInfo<MessageBodyReader<?>>((MessageBodyReader<?>)jsonProvider));
+            jaxbWriters.add(new ProviderInfo<MessageBodyWriter<?>>((MessageBodyWriter<?>)jsonProvider));
         }
         injectContextProxies(jaxbReaders, jaxbWriters);
     }
@@ -164,7 +165,7 @@ public final class ProviderFactory {
     public <T> ContextResolver<T> createContextResolver(Type contextType, 
                                                         Message m,
                                                         MediaType type) {
-        for (ProviderInfo<ContextResolver> cr : contextResolvers) {
+        for (ProviderInfo<ContextResolver<?>> cr : contextResolvers) {
             Type[] types = cr.getProvider().getClass().getGenericInterfaces();
             for (Type t : types) {
                 if (t instanceof ParameterizedType) {
@@ -173,7 +174,7 @@ public final class ProviderFactory {
                     for (int i = 0; i < args.length; i++) {
                         if (contextType == args[i]) {
                             injectContextValues(cr, m);
-                            return cr.getProvider();
+                            return (ContextResolver<T>) cr.getProvider();
                         }
                     }
                 }
@@ -197,51 +198,51 @@ public final class ProviderFactory {
     private <T extends Throwable> ExceptionMapper<T> doCreateExceptionMapper(
         Class<?> exceptionType, Message m) {
         
-        List<ExceptionMapper<T>> candidates = new LinkedList<ExceptionMapper<T>>();
+        List<ExceptionMapper<?>> candidates = new LinkedList<ExceptionMapper<?>>();
         
-        for (ProviderInfo<ExceptionMapper> em : exceptionMappers) {
-            handleMapper((List)candidates, em, exceptionType, m, ExceptionMapper.class, true);
+        for (ProviderInfo<ExceptionMapper<?>> em : exceptionMappers) {
+            handleMapper(candidates, em, exceptionType, m, ExceptionMapper.class, true);
         }
         if (candidates.size() == 0) {
             return null;
         }
         Collections.sort(candidates, new ExceptionMapperComparator());
-        return candidates.get(0);
+        return (ExceptionMapper<T>) candidates.get(0);
     }
     
     @SuppressWarnings("unchecked")
     public <T> ParameterHandler<T> createParameterHandler(Class<?> paramType) {
         
-        List<ParameterHandler<T>> candidates = new LinkedList<ParameterHandler<T>>();
+        List<ParameterHandler<?>> candidates = new LinkedList<ParameterHandler<?>>();
         
-        for (ProviderInfo<ParameterHandler> em : paramHandlers) {
-            handleMapper((List)candidates, em, paramType, null, ParameterHandler.class, true);
+        for (ProviderInfo<ParameterHandler<?>> em : paramHandlers) {
+            handleMapper(candidates, em, paramType, null, ParameterHandler.class, true);
         }
         if (candidates.size() == 0) {
             return null;
         }
         Collections.sort(candidates, new ClassComparator());
-        return candidates.get(0);
+        return (ParameterHandler<T>) candidates.get(0);
     }
     
     @SuppressWarnings("unchecked")
     public <T extends Throwable> ResponseExceptionMapper<T> createResponseExceptionMapper(
                                  Class<?> paramType) {
         
-        List<ResponseExceptionMapper<T>> candidates = new LinkedList<ResponseExceptionMapper<T>>();
+        List<ResponseExceptionMapper<?>> candidates = new LinkedList<ResponseExceptionMapper<?>>();
         
-        for (ProviderInfo<ResponseExceptionMapper> em : responseExceptionMappers) {
-            handleMapper((List)candidates, em, paramType, null, ResponseExceptionMapper.class, true);
+        for (ProviderInfo<ResponseExceptionMapper<?>> em : responseExceptionMappers) {
+            handleMapper(candidates, em, paramType, null, ResponseExceptionMapper.class, true);
         }
         if (candidates.size() == 0) {
             return null;
         }
         Collections.sort(candidates, new ClassComparator());
-        return candidates.get(0);
+        return (ResponseExceptionMapper<T>) candidates.get(0);
     }
     
-    private static <T> void handleMapper(List<Object> candidates, 
-                                     ProviderInfo em, 
+    private static <T> void handleMapper(List<T> candidates, 
+                                     ProviderInfo<T> em, 
                                      Class<?> expectedType, 
                                      Message m, 
                                      Class<?> providerClass,
@@ -406,15 +407,15 @@ public final class ProviderFactory {
             Class<?> oClass = ClassHelper.getRealClass(o);
             
             if (MessageBodyReader.class.isAssignableFrom(oClass)) {
-                messageReaders.add(new ProviderInfo<MessageBodyReader>((MessageBodyReader)o)); 
+                messageReaders.add(new ProviderInfo<MessageBodyReader<?>>((MessageBodyReader<?>)o)); 
             }
             
             if (MessageBodyWriter.class.isAssignableFrom(oClass)) {
-                messageWriters.add(new ProviderInfo<MessageBodyWriter>((MessageBodyWriter)o)); 
+                messageWriters.add(new ProviderInfo<MessageBodyWriter<?>>((MessageBodyWriter<?>)o)); 
             }
             
             if (ContextResolver.class.isAssignableFrom(oClass)) {
-                contextResolvers.add(new ProviderInfo<ContextResolver>((ContextResolver)o)); 
+                contextResolvers.add(new ProviderInfo<ContextResolver<?>>((ContextResolver<?>)o)); 
             }
             
             if (RequestHandler.class.isAssignableFrom(oClass)) {
@@ -426,26 +427,27 @@ public final class ProviderFactory {
             }
             
             if (ExceptionMapper.class.isAssignableFrom(oClass)) {
-                exceptionMappers.add(new ProviderInfo<ExceptionMapper>((ExceptionMapper)o)); 
+                exceptionMappers.add(new ProviderInfo<ExceptionMapper<?>>((ExceptionMapper<?>)o)); 
             }
             
             if (ResponseExceptionMapper.class.isAssignableFrom(oClass)) {
-                responseExceptionMappers.add(new ProviderInfo<ResponseExceptionMapper>((ResponseExceptionMapper)o)); 
+                responseExceptionMappers.add(new ProviderInfo<ResponseExceptionMapper<?>>((ResponseExceptionMapper<?>)o)); 
             }
             
             if (ParameterHandler.class.isAssignableFrom(oClass)) {
-                paramHandlers.add(new ProviderInfo<ParameterHandler>((ParameterHandler)o)); 
+                paramHandlers.add(new ProviderInfo<ParameterHandler<?>>((ParameterHandler<?>)o)); 
             }
         }
         sortReaders();
         sortWriters();
         
-        injectContextProxies(messageReaders, messageWriters, contextResolvers, requestHandlers, responseHandlers,
+        injectContextProxies(messageReaders, messageWriters, contextResolvers, 
+        			requestHandlers, responseHandlers,
                        exceptionMappers);
     }
 //CHECKSTYLE:ON
     
-    static void injectContextValues(ProviderInfo pi, Message m) {
+    static void injectContextValues(ProviderInfo<?> pi, Message m) {
         if (m != null) {
             InjectionUtils.injectContextFields(pi.getProvider(), pi, m);
             InjectionUtils.injectContextMethods(pi.getProvider(), pi, m);
@@ -454,8 +456,8 @@ public final class ProviderFactory {
     
     void injectContextProxies(List<?> ... providerLists) {
         for (List<?> list : providerLists) {
-            for (Object p : list) {
-                ProviderInfo pi = (ProviderInfo)p;
+            List<ProviderInfo<?>> l2 = CastUtils.cast(list);
+            for (ProviderInfo<?> pi : l2) {
                 if (ProviderFactory.SHARED_FACTORY == this && isJaxbBasedProvider(pi.getProvider())) {
                     continue;
                 }
@@ -492,19 +494,19 @@ public final class ProviderFactory {
      * @return
      */
     @SuppressWarnings("unchecked")
-    private <T> MessageBodyReader<T> chooseMessageReader(List<ProviderInfo<MessageBodyReader>> readers,
+    private <T> MessageBodyReader<T> chooseMessageReader(List<ProviderInfo<MessageBodyReader<?>>> readers,
                                                          Class<T> type,
                                                          Type genericType,
                                                          Annotation[] annotations,
                                                          MediaType mediaType,
                                                          Message m) {
-        List<MessageBodyReader<T>> candidates = new LinkedList<MessageBodyReader<T>>();
-        for (ProviderInfo<MessageBodyReader> ep : readers) {
+        List<MessageBodyReader<?>> candidates = new LinkedList<MessageBodyReader<?>>();
+        for (ProviderInfo<MessageBodyReader<?>> ep : readers) {
             if (matchesReaderCriterias(ep, type, genericType, annotations, mediaType, m)) {
                 if (this == SHARED_FACTORY) {
-                    return ep.getProvider();
+                    return (MessageBodyReader<T>) ep.getProvider();
                 }
-                handleMapper((List)candidates, ep, type, m, MessageBodyReader.class, false);
+                handleMapper(candidates, ep, type, m, MessageBodyReader.class, false);
             }
         }     
         
@@ -512,11 +514,11 @@ public final class ProviderFactory {
             return null;
         }
         Collections.sort(candidates, new ClassComparator());
-        return candidates.get(0);
+        return (MessageBodyReader<T>) candidates.get(0);
         
     }
     
-    private <T> boolean matchesReaderCriterias(ProviderInfo<MessageBodyReader> pi,
+    private <T> boolean matchesReaderCriterias(ProviderInfo<MessageBodyReader<?>> pi,
                                                Class<T> type,
                                                Type genericType,
                                                Annotation[] annotations,
@@ -554,29 +556,29 @@ public final class ProviderFactory {
      * @return
      */
     @SuppressWarnings("unchecked")
-    private <T> MessageBodyWriter<T> chooseMessageWriter(List<ProviderInfo<MessageBodyWriter>> writers,
+    private <T> MessageBodyWriter<T> chooseMessageWriter(List<ProviderInfo<MessageBodyWriter<?>>> writers,
                                                          Class<T> type,
                                                          Type genericType,
                                                          Annotation[] annotations,
                                                          MediaType mediaType,
                                                          Message m) {
-        List<MessageBodyWriter<T>> candidates = new LinkedList<MessageBodyWriter<T>>();
-        for (ProviderInfo<MessageBodyWriter> ep : writers) {
+        List<MessageBodyWriter<?>> candidates = new LinkedList<MessageBodyWriter<?>>();
+        for (ProviderInfo<MessageBodyWriter<?>> ep : writers) {
             if (matchesWriterCriterias(ep, type, genericType, annotations, mediaType, m)) {
                 if (this == SHARED_FACTORY) {
-                    return ep.getProvider();
+                    return (MessageBodyWriter<T>) ep.getProvider();
                 }
-                handleMapper((List)candidates, ep, type, m, MessageBodyWriter.class, false);
+                handleMapper(candidates, ep, type, m, MessageBodyWriter.class, false);
             }
         }     
         if (candidates.size() == 0) {
             return null;
         }
         Collections.sort(candidates, new ClassComparator());
-        return candidates.get(0);
+        return (MessageBodyWriter<T>) candidates.get(0);
     }
     
-    private <T> boolean matchesWriterCriterias(ProviderInfo<MessageBodyWriter> pi,
+    private <T> boolean matchesWriterCriterias(ProviderInfo<MessageBodyWriter<?>> pi,
                                                Class<T> type,
                                                Type genericType,
                                                Annotation[] annotations,
@@ -604,15 +606,15 @@ public final class ProviderFactory {
         return matches;
     }
     
-    List<ProviderInfo<MessageBodyReader>> getMessageReaders() {
+    List<ProviderInfo<MessageBodyReader<?>>> getMessageReaders() {
         return Collections.unmodifiableList(messageReaders);
     }
 
-    List<ProviderInfo<MessageBodyWriter>> getMessageWriters() {
+    List<ProviderInfo<MessageBodyWriter<?>>> getMessageWriters() {
         return Collections.unmodifiableList(messageWriters);
     }
     
-    List<ProviderInfo<ContextResolver>> getContextResolvers() {
+    List<ProviderInfo<ContextResolver<?>>> getContextResolvers() {
         return Collections.unmodifiableList(contextResolvers);
     }
     
@@ -629,12 +631,12 @@ public final class ProviderFactory {
     }
 
     private static class MessageBodyReaderComparator 
-        implements Comparator<ProviderInfo<MessageBodyReader>> {
+        implements Comparator<ProviderInfo<MessageBodyReader<?>>> {
         
-        public int compare(ProviderInfo<MessageBodyReader> p1, 
-                           ProviderInfo<MessageBodyReader> p2) {
-            MessageBodyReader e1 = p1.getProvider();
-            MessageBodyReader e2 = p2.getProvider();
+        public int compare(ProviderInfo<MessageBodyReader<?>> p1, 
+                           ProviderInfo<MessageBodyReader<?>> p2) {
+            MessageBodyReader<?> e1 = p1.getProvider();
+            MessageBodyReader<?> e2 = p2.getProvider();
             List<MediaType> types1 = JAXRSUtils.getProviderConsumeTypes(e1);
             types1 = JAXRSUtils.sortMediaTypes(types1);
             List<MediaType> types2 = JAXRSUtils.getProviderConsumeTypes(e2);
@@ -645,12 +647,12 @@ public final class ProviderFactory {
     }
     
     private static class MessageBodyWriterComparator 
-        implements Comparator<ProviderInfo<MessageBodyWriter>> {
+        implements Comparator<ProviderInfo<MessageBodyWriter<?>>> {
         
-        public int compare(ProviderInfo<MessageBodyWriter> p1, 
-                           ProviderInfo<MessageBodyWriter> p2) {
-            MessageBodyWriter e1 = p1.getProvider();
-            MessageBodyWriter e2 = p2.getProvider();
+        public int compare(ProviderInfo<MessageBodyWriter<?>> p1, 
+                           ProviderInfo<MessageBodyWriter<?>> p2) {
+            MessageBodyWriter<?> e1 = p1.getProvider();
+            MessageBodyWriter<?> e2 = p2.getProvider();
             
             List<MediaType> types1 =
                 JAXRSUtils.sortMediaTypes(JAXRSUtils.getProviderProduceTypes(e1));
@@ -690,8 +692,8 @@ public final class ProviderFactory {
     
     void clearProxies(List<?> ...lists) {
         for (List<?> list : lists) {
-            for (Object p : list) {
-                ProviderInfo pi = (ProviderInfo)p;
+            List<ProviderInfo<?>> l2 = CastUtils.cast(list);
+            for (ProviderInfo<?> pi : l2) {
                 pi.clearThreadLocalProxies();
             }
         }
@@ -712,7 +714,7 @@ public final class ProviderFactory {
         if (bus == null) {
             return;
         }
-        for (ProviderInfo<MessageBodyReader> r : messageReaders) {
+        for (ProviderInfo<MessageBodyReader<?>> r : messageReaders) {
             injectProviderProperty(r.getProvider(), "setBus", Bus.class, bus);
         }
     }
@@ -731,12 +733,12 @@ public final class ProviderFactory {
     
     public void setSchemaLocations(List<String> schemas) {
         boolean schemasMethodAvailable = false;
-        for (ProviderInfo<MessageBodyReader> r : messageReaders) {
+        for (ProviderInfo<MessageBodyReader<?>> r : messageReaders) {
             schemasMethodAvailable = injectProviderProperty(r.getProvider(), "setSchemas", 
                                                             List.class, schemas);
         }
         if (!schemasMethodAvailable) {
-            for (ProviderInfo<MessageBodyReader> r : jaxbReaders) {
+            for (ProviderInfo<MessageBodyReader<?>> r : jaxbReaders) {
                 schemasMethodAvailable = injectProviderProperty(r.getProvider(), "setSchemas", 
                                                                 List.class, schemas);
             }
@@ -746,7 +748,7 @@ public final class ProviderFactory {
     public void initProviders(List<ClassResourceInfo> cris) {
         Set<Object> set = getReadersWriters();
         for (Object o : set) {
-            Object provider = ((ProviderInfo)o).getProvider();
+            Object provider = ((ProviderInfo<?>)o).getProvider();
             if (provider instanceof AbstractConfigurableProvider) {
                 ((AbstractConfigurableProvider)provider).init(cris);
             }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/SourceProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/SourceProvider.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/SourceProvider.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/SourceProvider.java Mon Jan  9 20:07:20 2012
@@ -54,8 +54,8 @@ import org.apache.cxf.staxutils.StaxUtil
 @Provider
 @Produces({"application/xml", "application/*+xml", "text/xml" })
 @Consumes({"application/xml", "application/*+xml", "text/xml", "text/html" })
-public class SourceProvider extends AbstractConfigurableProvider implements 
-    MessageBodyReader<Object>, MessageBodyWriter<Object> {
+public class SourceProvider<T> extends AbstractConfigurableProvider implements 
+    MessageBodyReader<T>, MessageBodyWriter<T> {
 
     private static final String PREFERRED_FORMAT = "source-preferred-format";
     @Context
@@ -73,7 +73,7 @@ public class SourceProvider extends Abst
                || Document.class.isAssignableFrom(type);
     }
     
-    public Object readFrom(Class<Object> source, Type genericType, Annotation[] annotations, MediaType m,  
+    public T readFrom(Class<T> source, Type genericType, Annotation[] annotations, MediaType m,  
         MultivaluedMap<String, String> headers, InputStream is) 
         throws IOException {
         
@@ -91,7 +91,7 @@ public class SourceProvider extends Abst
             XMLStreamReader reader = getReader(is);
             try {
                 Document doc = StaxUtils.read(reader);
-                return docRequired ? doc : new DOMSource(doc);
+                return source.cast(docRequired ? doc : new DOMSource(doc));
             } catch (Exception e) {
                 IOException ioex = new IOException("Problem creating a Source object");
                 ioex.setStackTrace(e.getStackTrace());
@@ -105,12 +105,12 @@ public class SourceProvider extends Abst
             }
         } else if (SAXSource.class.isAssignableFrom(theSource)
                   || StaxSource.class.isAssignableFrom(theSource)) {
-            return new StaxSource(getReader(is));
+            return source.cast(new StaxSource(getReader(is)));
         } else if (StreamSource.class.isAssignableFrom(theSource)
                    || Source.class.isAssignableFrom(theSource)) {
-            return new StreamSource(getRealStream(is));
+            return source.cast(new StreamSource(getRealStream(is)));
         } else if (XMLSource.class.isAssignableFrom(theSource)) {
-            return new XMLSource(getRealStream(is));
+            return source.cast(new XMLSource(getRealStream(is)));
         }
         
         throw new IOException("Unrecognized source");
@@ -149,7 +149,7 @@ public class SourceProvider extends Abst
         }
     }
     
-    public void writeTo(Object source, Class<?> clazz, Type genericType, Annotation[] annotations,  
+    public void writeTo(T source, Class<?> clazz, Type genericType, Annotation[] annotations,  
         MediaType mt, MultivaluedMap<String, Object> headers, OutputStream os)
         throws IOException {
         
@@ -177,7 +177,7 @@ public class SourceProvider extends Abst
         }
     }
     
-    public long getSize(Object source, Class<?> type, Type genericType, Annotation[] annotations, 
+    public long getSize(T source, Class<?> type, Type genericType, Annotation[] annotations, 
                         MediaType mt) {
         return -1;
     }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XMLBeansElementProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XMLBeansElementProvider.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XMLBeansElementProvider.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XMLBeansElementProvider.java Mon Jan  9 20:07:20 2012
@@ -92,7 +92,7 @@ public class XMLBeansElementProvider ext
      * @param reader stream reader for the XML stream
      * @return an XMLBean data object, or none if unable to process
      */
-    protected XmlObject parseXmlBean(Class type, XMLStreamReader reader) {
+    protected XmlObject parseXmlBean(Class<?> type, XMLStreamReader reader) {
 
         XmlObject result = null;
 
@@ -130,7 +130,7 @@ public class XMLBeansElementProvider ext
      * @param inStream
      * @return an XMLBean object if successful, otherwise null
      */
-    protected XmlObject parseXmlBean(Class type, InputStream inStream) {
+    protected XmlObject parseXmlBean(Class<?> type, InputStream inStream) {
         XmlObject result = null;
 
         Reader r = new InputStreamReader(inStream);
@@ -148,7 +148,7 @@ public class XMLBeansElementProvider ext
      * @param reader
      * @return an instance of the required object, otherwise null
      */
-    protected XmlObject parseXmlBean(Class type, Reader reader) {
+    protected XmlObject parseXmlBean(Class<?> type, Reader reader) {
         XmlObject result = null;
 
         Class<?> factory = getFactory(type);
@@ -181,17 +181,17 @@ public class XMLBeansElementProvider ext
      * @param type
      * @return the Factory class if present, otherwise null.
      */
-    private Class getFactory(Class type) {
-        Class result = null;
+    private Class<?> getFactory(Class<?> type) {
+        Class<?> result = null;
 
-        Class[] interfaces = type.getInterfaces();
+        Class<?>[] interfaces = type.getInterfaces();
 
         // look for XMLBeans inner class Factory
-        for (Class inter : interfaces) {
+        for (Class<?> inter : interfaces) {
 
-            Class[] declared = inter.getDeclaredClasses();
+            Class<?>[] declared = inter.getDeclaredClasses();
 
-            for (Class c : declared) {
+            for (Class<?> c : declared) {
 
                 if (c.getSimpleName().equals("Factory")) {
                     result = c;
@@ -211,21 +211,21 @@ public class XMLBeansElementProvider ext
      * @param type
      * @return true if found to be an XMLBean object, otherwise false
      */
-    protected boolean isXmlBean(Class type) {
+    protected boolean isXmlBean(Class<?> type) {
         boolean result = false;
 
-        Class[] interfaces = {type};
+        Class<?>[] interfaces = {type};
 
         if (!type.isInterface()) {
 
             interfaces = type.getInterfaces();
         }
 
-        for (Class i : interfaces) {
+        for (Class<?> i : interfaces) {
 
-            Class[] superInterfaces = i.getInterfaces();
+            Class<?>[] superInterfaces = i.getInterfaces();
 
-            for (Class superI : superInterfaces) {
+            for (Class<?> superI : superInterfaces) {
 
                 if (superI.getName().equals("org.apache.xmlbeans.XmlObject")) {
                     result = true;

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XPathProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XPathProvider.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XPathProvider.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XPathProvider.java Mon Jan  9 20:07:20 2012
@@ -37,7 +37,7 @@ import org.apache.cxf.jaxrs.ext.xml.XMLS
 
 @Provider
 @Consumes({"text/xml", "application/xml", "application/*+xml" })
-public class XPathProvider implements MessageBodyReader<Object> {
+public class XPathProvider<T> implements MessageBodyReader<T> {
 
     private List<String> consumeMediaTypes;
     private Map<String, String> classExpressions;
@@ -77,7 +77,7 @@ public class XPathProvider implements Me
             || classExpressions != null && classExpressions.containsKey(cls.getName());
     }
 
-    public Object readFrom(Class<Object> cls, Type type, Annotation[] anns, MediaType mt, 
+    public T readFrom(Class<T> cls, Type type, Annotation[] anns, MediaType mt, 
         MultivaluedMap<String, String> hrs, InputStream is) throws IOException, WebApplicationException {
         String expression = globalExpression != null ? globalExpression
             : classExpressions.get(cls.getName());

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/XSLTJaxbProvider.java Mon Jan  9 20:07:20 2012
@@ -70,7 +70,7 @@ import org.apache.cxf.staxutils.StaxUtil
 @Produces({"application/xml", "application/*+xml", "text/xml", "text/html" })
 @Consumes({"application/xml", "application/*+xml", "text/xml", "text/html" })
 @Provider
-public class XSLTJaxbProvider extends JAXBElementProvider {
+public class XSLTJaxbProvider<T> extends JAXBElementProvider<T> {
     
     private static final Logger LOG = LogUtils.getL7dLogger(XSLTJaxbProvider.class);
     

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/servlet/CXFNonSpringJaxrsServlet.java Mon Jan  9 20:07:20 2012
@@ -97,16 +97,16 @@ public class CXFNonSpringJaxrsServlet ex
         setSchemasLocations(bean, servletConfig);
         setAllInterceptors(bean, servletConfig);
         
-        Map<Class, Map<String, String>> resourceClasses = 
+        Map<Class<?>, Map<String, String>> resourceClasses = 
             getServiceClasses(servletConfig, modelRef != null);
-        Map<Class, ResourceProvider> resourceProviders = 
+        Map<Class<?>, ResourceProvider> resourceProviders = 
             getResourceProviders(servletConfig, resourceClasses);
         
         List<?> providers = getProviders(servletConfig);
                 
-        bean.setResourceClasses(new ArrayList<Class>(resourceClasses.keySet()));
+        bean.setResourceClasses(new ArrayList<Class<?>>(resourceClasses.keySet()));
         bean.setProviders(providers);
-        for (Map.Entry<Class, ResourceProvider> entry : resourceProviders.entrySet()) {
+        for (Map.Entry<Class<?>, ResourceProvider> entry : resourceProviders.entrySet()) {
             bean.setResourceProvider(entry.getKey(), entry.getValue());
         }
         setExtensions(bean, servletConfig);
@@ -202,7 +202,7 @@ public class CXFNonSpringJaxrsServlet ex
         }
     }
     
-    protected Map<Class, Map<String, String>> getServiceClasses(ServletConfig servletConfig,
+    protected Map<Class<?>, Map<String, String>> getServiceClasses(ServletConfig servletConfig,
                                             boolean modelAvailable) throws ServletException {
         String serviceBeans = servletConfig.getInitParameter(SERVICE_CLASSES_PARAM);
         if (serviceBeans == null) {
@@ -212,7 +212,7 @@ public class CXFNonSpringJaxrsServlet ex
             throw new ServletException("At least one resource class should be specified");
         }
         String[] classNames = serviceBeans.split(" ");
-        Map<Class, Map<String, String>> map = new HashMap<Class, Map<String, String>>();
+        Map<Class<?>, Map<String, String>> map = new HashMap<Class<?>, Map<String, String>>();
         for (String cName : classNames) {
             Map<String, String> props = new HashMap<String, String>();
             String theName = getClassNameAndProperties(cName, props);
@@ -256,16 +256,16 @@ public class CXFNonSpringJaxrsServlet ex
         return theName;
     }
     
-    protected Map<Class, ResourceProvider> getResourceProviders(ServletConfig servletConfig,
-            Map<Class, Map<String, String>> resourceClasses) throws ServletException {
+    protected Map<Class<?>, ResourceProvider> getResourceProviders(ServletConfig servletConfig,
+            Map<Class<?>, Map<String, String>> resourceClasses) throws ServletException {
         String scope = servletConfig.getInitParameter(SERVICE_SCOPE_PARAM);
         if (scope != null && !SERVICE_SCOPE_SINGLETON.equals(scope)
             && !SERVICE_SCOPE_REQUEST.equals(scope)) {
             throw new ServletException("Only singleton and prototype scopes are supported");
         }
         boolean isPrototype = SERVICE_SCOPE_REQUEST.equals(scope);
-        Map<Class, ResourceProvider> map = new HashMap<Class, ResourceProvider>();
-        for (Map.Entry<Class, Map<String, String>> entry : resourceClasses.entrySet()) {
+        Map<Class<?>, ResourceProvider> map = new HashMap<Class<?>, ResourceProvider>();
+        for (Map.Entry<Class<?>, Map<String, String>> entry : resourceClasses.entrySet()) {
             Class<?> c = entry.getKey();
             map.put(c, isPrototype ? new PerRequestResourceProvider(c)
                                    : new SingletonResourceProvider(

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSClientFactoryBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSClientFactoryBeanDefinitionParser.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSClientFactoryBeanDefinitionParser.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSClientFactoryBeanDefinitionParser.java Mon Jan  9 20:07:20 2012
@@ -74,7 +74,7 @@ public class JAXRSClientFactoryBeanDefin
     @Override
     protected void mapElement(ParserContext ctx, BeanDefinitionBuilder bean, Element el, String name) {
         if ("properties".equals(name) || "headers".equals(name)) {
-            Map map = ctx.getDelegate().parseMapElement(el, bean.getBeanDefinition());
+            Map<?, ?> map = ctx.getDelegate().parseMapElement(el, bean.getBeanDefinition());
             bean.addPropertyValue(name, map);
         } else if ("executor".equals(name)) {
             setFirstChildAsProperty(el, ctx, bean, "serviceFactory.executor");         
@@ -82,11 +82,11 @@ public class JAXRSClientFactoryBeanDefin
             setFirstChildAsProperty(el, ctx, bean, "bindingConfig");
         } else if ("inInterceptors".equals(name) || "inFaultInterceptors".equals(name)
             || "outInterceptors".equals(name) || "outFaultInterceptors".equals(name)) {
-            List list = ctx.getDelegate().parseListElement(el, bean.getBeanDefinition());
+            List<?> list = ctx.getDelegate().parseListElement(el, bean.getBeanDefinition());
             bean.addPropertyValue(name, list);
         } else if ("features".equals(name) || "providers".equals(name)
                    || "schemaLocations".equals(name) || "modelBeans".equals(name)) {
-            List list = ctx.getDelegate().parseListElement(el, bean.getBeanDefinition());
+            List<?> list = ctx.getDelegate().parseListElement(el, bean.getBeanDefinition());
             bean.addPropertyValue(name, list);
         } else if ("model".equals(name)) {
             List<UserResource> resources = ResourceUtils.getResourcesFromElement(el);

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java Mon Jan  9 20:07:20 2012
@@ -76,7 +76,7 @@ public class JAXRSServerFactoryBeanDefin
         if ("properties".equals(name) 
             || "extensionMappings".equals(name)
             || "languageMappings".equals(name)) {
-            Map map = ctx.getDelegate().parseMapElement(el, bean.getBeanDefinition());
+            Map<?, ?> map = ctx.getDelegate().parseMapElement(el, bean.getBeanDefinition());
             bean.addPropertyValue(name, map);
         } else if ("executor".equals(name)) {
             setFirstChildAsProperty(el, ctx, bean, "serviceFactory.executor");
@@ -86,15 +86,15 @@ public class JAXRSServerFactoryBeanDefin
             setFirstChildAsProperty(el, ctx, bean, "bindingConfig");
         } else if ("inInterceptors".equals(name) || "inFaultInterceptors".equals(name)
             || "outInterceptors".equals(name) || "outFaultInterceptors".equals(name)) {
-            List list = ctx.getDelegate().parseListElement(el, bean.getBeanDefinition());
+            List<?> list = ctx.getDelegate().parseListElement(el, bean.getBeanDefinition());
             bean.addPropertyValue(name, list);
         } else if ("features".equals(name) || "schemaLocations".equals(name) 
             || "providers".equals(name) || "serviceBeans".equals(name)
             || "modelBeans".equals(name)) {
-            List list = ctx.getDelegate().parseListElement(el, bean.getBeanDefinition());
+            List<?> list = ctx.getDelegate().parseListElement(el, bean.getBeanDefinition());
             bean.addPropertyValue(name, list);
         }  else if ("serviceFactories".equals(name)) {
-            List list = ctx.getDelegate().parseListElement(el, bean.getBeanDefinition());
+            List<?> list = ctx.getDelegate().parseListElement(el, bean.getBeanDefinition());
             bean.addPropertyValue("resourceProviders", list);
         } else if ("model".equals(name)) {
             List<UserResource> resources = ResourceUtils.getResourcesFromElement(el);

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/InjectionUtils.java Mon Jan  9 20:07:20 2012
@@ -277,20 +277,19 @@ public final class InjectionUtils {
         return null;
     }
     
-    public static Object handleParameter(String value, 
-                                         boolean decoded,
-                                         Class<?> pClass,
-                                         Annotation[] paramAnns,
-                                         ParameterType pType,
-                                         Message message) {
-        
+    public static <T> T handleParameter(String value, 
+                                        boolean decoded,
+                                        Class<T> pClass,
+                                        Annotation[] paramAnns,
+                                        ParameterType pType,
+                                        Message message) {
         if (value == null) {
             return null;
         }
         
         if (pType == ParameterType.PATH) {
             if (PathSegment.class.isAssignableFrom(pClass)) {
-                return new PathSegmentImpl(value, decoded);   
+                return pClass.cast(new PathSegmentImpl(value, decoded));   
             } else {
                 value = new PathSegmentImpl(value, false).getPath();                 
             }
@@ -298,10 +297,14 @@ public final class InjectionUtils {
         
         value = decodeValue(value, decoded, pType);
         
-        
         if (pClass.isPrimitive()) {
             try {
-                return PrimitiveUtils.read(value, pClass);
+                @SuppressWarnings("unchecked")
+                T ret = (T)PrimitiveUtils.read(value, pClass);
+                // cannot us pClass.cast as the pClass is something like
+                // Boolean.TYPE (representing the boolean primitive) and
+                // the object is a Boolean object
+                return ret;
             } catch (NumberFormatException nfe) {
                 //
                 //  For path, query & matrix parameters this is 404,
@@ -316,26 +319,27 @@ public final class InjectionUtils {
         }
         
         boolean adapterHasToBeUsed = false;
+        Class<?> cls = pClass;        
         Class<?> valueType = JAXBUtils.getValueTypeFromAdapter(pClass, pClass, paramAnns);
-        if (valueType != pClass) {
-            pClass = valueType;
+        if (valueType != cls) {
+            cls = valueType;
             adapterHasToBeUsed = true;
         }
         
-        Object result = instantiateFromParameterHandler(value, pClass, message);
+        Object result = instantiateFromParameterHandler(value, cls, message);
         if (result != null) {
-            return result;
+            return pClass.cast(result);
         }
         // check constructors accepting a single String value
         try {
-            Constructor<?> c = pClass.getConstructor(new Class<?>[]{String.class});
+            Constructor<?> c = cls.getConstructor(new Class<?>[]{String.class});
             result = c.newInstance(new Object[]{value});
         } catch (NoSuchMethodException ex) {
             // try valueOf
         } catch (WebApplicationException ex) {
             throw ex;
         } catch (Exception ex) {
-            result = createFromParameterHandler(value, pClass, message);
+            result = createFromParameterHandler(value, cls, message);
             if (result == null) {
                 LOG.severe(new org.apache.cxf.common.i18n.Message("CLASS_CONSTRUCTOR_FAILURE", 
                                                                    BUNDLE, 
@@ -345,11 +349,11 @@ public final class InjectionUtils {
         }
         if (result == null) {
             // check for valueOf(String) static methods
-            String[] methodNames = pClass.isEnum() 
+            String[] methodNames = cls.isEnum() 
                 ? new String[] {"fromString", "fromValue", "valueOf"} 
                 : new String[] {"valueOf", "fromString"};
             for (String mName : methodNames) {   
-                result = evaluateFactoryMethod(value, pClass, pType, mName);
+                result = evaluateFactoryMethod(value, cls, pType, mName);
                 if (result != null) {
                     break;
                 }
@@ -357,7 +361,7 @@ public final class InjectionUtils {
         }
         
         if (result == null) {
-            result = createFromParameterHandler(value, pClass, message);
+            result = createFromParameterHandler(value, cls, message);
         }
         
         if (result != null && adapterHasToBeUsed) {
@@ -373,11 +377,11 @@ public final class InjectionUtils {
             reportServerError("WRONG_PARAMETER_TYPE", pClass.getName());
         }
         
-        return result;
+        return pClass.cast(result);
     }
 
-    private static Object instantiateFromParameterHandler(String value, 
-                                                     Class<?> pClass,
+    private static <T> T instantiateFromParameterHandler(String value, 
+                                                     Class<T> pClass,
                                                      Message message) {
         // TODO: Consider always checking custom parameter handlers first.
         // Right now, Locale and Date are two special cases so it's very cheap
@@ -389,12 +393,12 @@ public final class InjectionUtils {
         }
     }
     
-    private static Object createFromParameterHandler(String value, 
-                                                     Class<?> pClass,
-                                                     Message message) {
-        Object result = null;
+    private static <T> T createFromParameterHandler(String value, 
+                                                    Class<T> pClass,
+                                                    Message message) {
+        T result = null;
         if (message != null) {
-            ParameterHandler<?> pm = ProviderFactory.getInstance(message)
+            ParameterHandler<T> pm = ProviderFactory.getInstance(message)
                 .createParameterHandler(pClass);
             if (pm != null) {
                 result = pm.fromString(value);
@@ -415,14 +419,14 @@ public final class InjectionUtils {
         throw new WebApplicationException(r);
     }
     
-    private static Object evaluateFactoryMethod(String value,
-                                                Class<?> pClass, 
+    private static <T> T evaluateFactoryMethod(String value,
+                                                Class<T> pClass, 
                                                 ParameterType pType, 
                                                 String methodName) {
         try {
             Method m = pClass.getMethod(methodName, new Class<?>[]{String.class});
             if (Modifier.isStatic(m.getModifiers())) {
-                return m.invoke(null, new Object[]{value});
+                return pClass.cast(m.invoke(null, new Object[]{value}));
             }
         } catch (NoSuchMethodException ex) {
             // no luck
@@ -839,8 +843,9 @@ public final class InjectionUtils {
     }
     
     // TODO : investigate the possibility of using generic proxies only
-    public static ThreadLocalProxy createThreadLocalProxy(Class<?> type) {
-        ThreadLocalProxy proxy = null;
+    @SuppressWarnings("unchecked")
+    public static <T> ThreadLocalProxy<T> createThreadLocalProxy(Class<T> type) {
+        ThreadLocalProxy<?> proxy = null;
         if (UriInfo.class.isAssignableFrom(type)) {
             proxy = new ThreadLocalUriInfo();
         } else if (HttpHeaders.class.isAssignableFrom(type)) {
@@ -850,7 +855,7 @@ public final class InjectionUtils {
         } else if (SecurityContext.class.isAssignableFrom(type)) {
             proxy = new ThreadLocalSecurityContext();
         } else if (ContextResolver.class.isAssignableFrom(type)) {
-            proxy = new ThreadLocalContextResolver();
+            proxy = new ThreadLocalContextResolver<Object>();
         } else if (Request.class.isAssignableFrom(type)) {
             proxy = new ThreadLocalRequest();
         }  else if (Providers.class.isAssignableFrom(type)) {
@@ -865,7 +870,7 @@ public final class InjectionUtils {
             proxy = createThreadLocalServletApiContext(type.getName());  
         }
         
-        return proxy;
+        return (ThreadLocalProxy<T>)proxy;
     }
     
     private static boolean isServletApiContext(String name) { 
@@ -927,8 +932,9 @@ public final class InjectionUtils {
         if (!cri.isSingleton()) {
             InjectionUtils.injectFieldValue(f, o, value);
         } else {
-            ThreadLocalProxy proxy = resource ? cri.getResourceFieldProxy(f)
-                                              : cri.getContextFieldProxy(f);
+            ThreadLocalProxy<Object> proxy =  (ThreadLocalProxy<Object>)(
+                    resource ? cri.getResourceFieldProxy(f)
+                        : cri.getContextFieldProxy(f));
             if (proxy != null) {
                 proxy.set(value);
             }
@@ -961,7 +967,8 @@ public final class InjectionUtils {
                 if (!cri.isSingleton()) {
                     InjectionUtils.injectThroughMethod(requestObject, method, o);
                 } else {
-                    ThreadLocalProxy proxy = cri.getContextSetterProxy(method);
+                    ThreadLocalProxy<Object> proxy 
+                        = (ThreadLocalProxy<Object>)cri.getContextSetterProxy(method);
                     if (proxy != null) {
                         proxy.set(o);
                     }
@@ -1110,13 +1117,12 @@ public final class InjectionUtils {
         }
     }
     
-    @SuppressWarnings("unchecked")
-    public static <T> T convertStringToPrimitive(String value, Class<T> cls) {
+    public static <T> Object convertStringToPrimitive(String value, Class<?> cls) {
         if (String.class == cls) {
-            return cls.cast(value);
+            return value;
         }
         if (cls.isPrimitive()) {
-            return (T)PrimitiveUtils.read(value, cls);
+            return PrimitiveUtils.read(value, cls);
         } else {
             try {
                 Method m = cls.getMethod("valueOf", new Class[]{String.class});

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java Mon Jan  9 20:07:20 2012
@@ -158,7 +158,7 @@ public final class JAXRSUtils {
         return values;
     }
     
-    public static List<MediaType> getProviderConsumeTypes(MessageBodyReader provider) {
+    public static List<MediaType> getProviderConsumeTypes(MessageBodyReader<?> provider) {
         String[] values = getUserMediaTypes(provider, "getConsumeMediaTypes");
         
         if (values == null) {
@@ -168,7 +168,7 @@ public final class JAXRSUtils {
         return JAXRSUtils.getMediaTypes(values);
     }
     
-    public static List<MediaType> getProviderProduceTypes(MessageBodyWriter provider) {
+    public static List<MediaType> getProviderProduceTypes(MessageBodyWriter<?> provider) {
         String[] values = getUserMediaTypes(provider, "getProduceMediaTypes");
         
         if (values == null) {
@@ -851,7 +851,7 @@ public final class JAXRSUtils {
             o = new SearchContextImpl(m);
         } else if (Application.class.isAssignableFrom(clazz)) {
             ProviderInfo<?> providerInfo = 
-                (ProviderInfo)contextMessage.getExchange().getEndpoint().get(Application.class.getName());
+                (ProviderInfo<?>)contextMessage.getExchange().getEndpoint().get(Application.class.getName());
             o = providerInfo == null ? providerInfo : providerInfo.getProvider();
         }
         if (o == null && contextMessage != null && !MessageUtils.isRequestor(contextMessage)) {
@@ -1011,8 +1011,7 @@ public final class JAXRSUtils {
         }
     }
 
-    @SuppressWarnings("unchecked")
-    private static <T> Object readFromMessageBody(Class<T> targetTypeClass,
+    private static <T> T readFromMessageBody(Class<T> targetTypeClass,
                                                   Type parameterType,
                                                   Annotation[] parameterAnnotations,
                                                   InputStream is, 
@@ -1022,7 +1021,7 @@ public final class JAXRSUtils {
         
         List<MediaType> types = JAXRSUtils.intersectMimeTypes(consumeTypes, contentType);
         
-        MessageBodyReader provider = null;
+        MessageBodyReader<T> provider = null;
         for (MediaType type : types) { 
             provider = ProviderFactory.getInstance(m)
                 .createMessageBodyReader(targetTypeClass,

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/ResourceUtils.java Mon Jan  9 20:07:20 2012
@@ -505,7 +505,7 @@ public final class ResourceUtils {
     }
     
     private static void checkJaxbType(Class<?> type, Map<Class<?>, Type> types) {
-        JAXBElementProvider provider = new JAXBElementProvider();
+        JAXBElementProvider<?> provider = new JAXBElementProvider<Object>();
         if (!InjectionUtils.isPrimitive(type) 
             && !JAXBElement.class.isAssignableFrom(type)
             && provider.isReadable(type, type, new Annotation[0], MediaType.APPLICATION_XML_TYPE)) {
@@ -553,13 +553,13 @@ public final class ResourceUtils {
         return op;
     }
     
-    @SuppressWarnings("unchecked")
     public static Object[] createConstructorArguments(Constructor<?> c, Message m) {
         Class<?>[] params = c.getParameterTypes();
         Annotation[][] anns = c.getParameterAnnotations();
         Type[] genericTypes = c.getGenericParameterTypes();
+        @SuppressWarnings("unchecked")
         MultivaluedMap<String, String> templateValues = m == null ? null
-            : (MultivaluedMap)m.get(URITemplate.TEMPLATE_PARAMETERS);
+            : (MultivaluedMap<String, String>)m.get(URITemplate.TEMPLATE_PARAMETERS);
         Object[] values = new Object[params.length];
         for (int i = 0; i < params.length; i++) {
             if (AnnotationUtils.isContextClass(params[i])) {
@@ -578,7 +578,7 @@ public final class ResourceUtils {
         Set<Object> singletons = app.getSingletons();
         verifySingletons(singletons);
         
-        List<Class> resourceClasses = new ArrayList<Class>();
+        List<Class<?>> resourceClasses = new ArrayList<Class<?>>();
         List<Object> providers = new ArrayList<Object>();
         Map<Class<?>, ResourceProvider> map = new HashMap<Class<?>, ResourceProvider>();
         

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/AttachmentUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/AttachmentUtils.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/AttachmentUtils.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/multipart/AttachmentUtils.java Mon Jan  9 20:07:20 2012
@@ -136,19 +136,17 @@ public final class AttachmentUtils {
         return false;
     }
 
-    @SuppressWarnings("unchecked")
-    public static <T> MultivaluedMap<String, T> populateFormMap(MessageContext mc, 
-                                                                Class<T> cls,
+    public static MultivaluedMap<String, String> populateFormMap(MessageContext mc, 
                                                                 boolean errorIfMissing) {
-        MultivaluedMap<String, T> data = new MetadataMap<String, T>();
-        FormUtils.populateMapFromMultipart((MultivaluedMap)data,
+        MultivaluedMap<String, String> data = new MetadataMap<String, String>();
+        FormUtils.populateMapFromMultipart(data,
                                            AttachmentUtils.getMultipartBody(mc), 
                                            true);
         return data;
     }
     
     public static MultivaluedMap<String, String> populateFormMap(MessageContext mc) {
-        return populateFormMap(mc, String.class, true);
+        return populateFormMap(mc, true);
     }
     
     private static Map<String, Attachment> fromListToMap(List<Attachment> atts) {

Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/CustomerInfo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/CustomerInfo.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/CustomerInfo.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/CustomerInfo.java Mon Jan  9 20:07:20 2012
@@ -26,7 +26,7 @@ import javax.ws.rs.ext.ContextResolver;
 
 public interface CustomerInfo {
     void setUriInfoContext(@Context UriInfo uriInfo);
-    ContextResolver getContextResolver();
+    ContextResolver<?> getContextResolver();
     
     @Context 
     void setHttpServletRequest(HttpServletRequest request);

Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXBContextProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXBContextProvider.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXBContextProvider.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/JAXBContextProvider.java Mon Jan  9 20:07:20 2012
@@ -24,7 +24,7 @@ import javax.xml.bind.JAXBContext;
 
 public class JAXBContextProvider implements ContextResolver<JAXBContext> {
 
-    public JAXBContext getContext(Class type) {
+    public JAXBContext getContext(Class<?> type) {
         // TODO Auto-generated method stub
         return null;
     }

Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/fortest/AbstractEntity2.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/fortest/AbstractEntity2.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/fortest/AbstractEntity2.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/fortest/AbstractEntity2.java Mon Jan  9 20:07:20 2012
@@ -21,5 +21,5 @@ package org.apache.cxf.jaxrs.fortest;
 
 
 
-public class AbstractEntity2<T, E> extends AbstractEntity {
+public class AbstractEntity2<T, E> extends AbstractEntity<T, E>  {
 }

Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/impl/UriBuilderImplTest.java Mon Jan  9 20:07:20 2012
@@ -514,7 +514,7 @@ public class UriBuilderImplTest extends 
 
     @Test(expected = IllegalArgumentException.class)
     public void testAddPathClassNull() throws Exception {
-        new UriBuilderImpl().path((Class)null).build();
+        new UriBuilderImpl().path((Class<?>)null).build();
     }
 
     @Test(expected = IllegalArgumentException.class)

Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java?rev=1229332&r1=1229331&r2=1229332&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java (original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/wadl/WadlGeneratorTest.java Mon Jan  9 20:07:20 2012
@@ -88,8 +88,8 @@ public class WadlGeneratorTest extends A
         
         ByteArrayOutputStream os = new ByteArrayOutputStream();
         
-        new JSONProvider().writeTo(
-                r.getEntity(), Document.class, Document.class, 
+        new JSONProvider<Document>().writeTo(
+                (Document)r.getEntity(), Document.class, Document.class, 
                   new Annotation[]{}, MediaType.APPLICATION_JSON_TYPE, 
                   new MetadataMap<String, Object>(), os);
         String s = os.toString();



Mime
View raw message