abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1173846 - in /abdera/abdera2/common/src/main/java/org/apache/abdera2/common: protocol/ templates/
Date Wed, 21 Sep 2011 20:51:44 GMT
Author: jmsnell
Date: Wed Sep 21 20:51:43 2011
New Revision: 1173846

URL: http://svn.apache.org/viewvc?rev=1173846&view=rev
Log:
fixes for no unique maximal instance errors during compile under some jvms.. silly generics
issues!

Modified:
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractBaseRequestContext.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractCollectionAdapter.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractResponseContext.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/BaseRequestContextWrapper.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/CollectionRequestProcessor.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/CompressionFilter.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/EntryRequestProcessor.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/MediaRequestProcessor.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/templates/DelegatingContext.java
    abdera/abdera2/common/src/main/java/org/apache/abdera2/common/templates/MultiContext.java

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractBaseRequestContext.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractBaseRequestContext.java?rev=1173846&r1=1173845&r2=1173846&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractBaseRequestContext.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractBaseRequestContext.java
Wed Sep 21 20:51:43 2011
@@ -107,7 +107,7 @@ public abstract class AbstractBaseReques
     }
 
     public <T extends RequestContext>T setAttribute(String name, Object value) {
-        return setAttribute(Scope.REQUEST, name, value);
+        return (T)setAttribute(Scope.REQUEST, name, value);
     }
 
     public String urlFor(Object key, Object param) {

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractCollectionAdapter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractCollectionAdapter.java?rev=1173846&r1=1173845&r2=1173846&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractCollectionAdapter.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractCollectionAdapter.java
Wed Sep 21 20:51:43 2011
@@ -129,7 +129,7 @@ public abstract class AbstractCollection
             log.warn("A ResponseException was thrown.", e);
         }
 
-        return e.getResponseContext();
+        return (S)e.getResponseContext();
     }
 
     /**

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractResponseContext.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractResponseContext.java?rev=1173846&r1=1173845&r2=1173846&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractResponseContext.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/AbstractResponseContext.java
Wed Sep 21 20:51:43 2011
@@ -56,11 +56,11 @@ public abstract class AbstractResponseCo
     }
 
     public <T extends ResponseContext>T setCacheControl(CacheControl cc) {
-      return setCacheControl(cc.toString());
+      return (T)setCacheControl(cc.toString());
     }
     
     public <T extends ResponseContext>T setCacheControl(String cc) {
-      return this.setHeader("Cache-Control", cc);
+      return (T)this.setHeader("Cache-Control", cc);
     }
     
     public <T extends ResponseContext>T removeHeader(String name) {
@@ -69,7 +69,7 @@ public abstract class AbstractResponseCo
     }
 
     public <T extends ResponseContext>T setEncodedHeader(String name, String charset,
String value) {
-        return setHeader(name, Codec.encode(value, charset));
+        return (T)setHeader(name, Codec.encode(value, charset));
     }
 
     public <T extends ResponseContext>T setEncodedHeader(String name, String charset,
String... vals) {
@@ -77,15 +77,15 @@ public abstract class AbstractResponseCo
         for (int n = 0; n < vals.length; n++) {
             evals[n] = Codec.encode(vals[n], charset);
         }
-        return setHeader(name, evals);
+        return (T)setHeader(name, evals);
     }
 
     public <T extends ResponseContext>T setEscapedHeader(String name, Profile profile,
String value) {
-        return setHeader(name, UrlEncoding.encode(value, profile));
+        return (T)setHeader(name, UrlEncoding.encode(value, profile));
     }
 
     public <T extends ResponseContext>T setHeader(String name, Object value) {
-        return setHeader(name, new Object[] {value});
+        return (T)setHeader(name, new Object[] {value});
     }
 
     public <T extends ResponseContext>T setHeader(String name, Object... vals) {
@@ -98,7 +98,7 @@ public abstract class AbstractResponseCo
     }
 
     public <T extends ResponseContext>T addEncodedHeader(String name, String charset,
String value) {
-        return addHeader(name, Codec.encode(value, charset));
+        return (T)addHeader(name, Codec.encode(value, charset));
     }
 
     public <T extends ResponseContext>T addEncodedHeaders(String name, String charset,
String... vals) {
@@ -109,7 +109,7 @@ public abstract class AbstractResponseCo
     }
 
     public <T extends ResponseContext>T addHeader(String name, Object value) {
-        return addHeaders(name, new Object[] {value});
+        return (T)addHeaders(name, new Object[] {value});
     }
 
     public <T extends ResponseContext>T addHeaders(String name, Object... vals) {
@@ -186,22 +186,22 @@ public abstract class AbstractResponseCo
         }
         if (slug.indexOf((char)10) > -1 || slug.indexOf((char)13) > -1)
             throw new IllegalArgumentException(Localizer.get("SLUG.BAD.CHARACTERS"));
-        return setEscapedHeader("Slug", Profile.PATHNODELIMS, slug);
+        return (T)setEscapedHeader("Slug", Profile.PATHNODELIMS, slug);
     }
 
     public <T extends ResponseContext>T setContentType(String type) {
-        return setContentType(type, null);
+        return (T)setContentType(type, null);
     }
 
     public <T extends ResponseContext>T setContentType(String type, String charset)
{
         if (type == null) {
-            return removeHeader("Content-Type");
+            return (T)removeHeader("Content-Type");
         }
         try {
             MimeType mimeType = new MimeType(type);
             if (charset != null)
                 mimeType.setParameter("charset", charset);
-            return setHeader("Content-Type", mimeType.toString());
+            return (T)setHeader("Content-Type", mimeType.toString());
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
@@ -246,7 +246,7 @@ public abstract class AbstractResponseCo
     }
 
     public <T extends ResponseContext>T setAllow(String method) {
-        return setHeader("Allow", method);
+        return (T)setHeader("Allow", method);
     }
 
     public <T extends ResponseContext>T setAllow(String... methods) {
@@ -256,18 +256,18 @@ public abstract class AbstractResponseCo
                 buf.append(", ");
             buf.append(method);
         }
-        return setAllow(buf.toString());
+        return (T)setAllow(buf.toString());
     }
 
     public <T extends ResponseContext>T setWebLinks(WebLink link, WebLink... links)
{
-      return setHeader("Link", WebLink.toString(link,links));
+      return (T)setHeader("Link", WebLink.toString(link,links));
     }
     
-    public <B extends ResponseContext>B setPrefer(Preference pref, Preference... prefs)
{
-      return setHeader("Prefer", Preference.toString(pref,prefs));
+    public <T extends ResponseContext>T setPrefer(Preference pref, Preference... prefs)
{
+      return (T)setHeader("Prefer", Preference.toString(pref,prefs));
     }
     
-    public <B extends ResponseContext>B setPreferApplied(Preference pref, Preference...
prefs) {
-      return setHeader("Preference-Applied", Preference.toString(pref,prefs));
+    public <T extends ResponseContext>T setPreferApplied(Preference pref, Preference...
prefs) {
+      return (T)setHeader("Preference-Applied", Preference.toString(pref,prefs));
     }
 }

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/BaseRequestContextWrapper.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/BaseRequestContextWrapper.java?rev=1173846&r1=1173845&r2=1173846&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/BaseRequestContextWrapper.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/BaseRequestContextWrapper.java
Wed Sep 21 20:51:43 2011
@@ -95,11 +95,11 @@ public class BaseRequestContextWrapper
     }
 
     public <T>T getProperty(Property property) {
-        return request.getProperty(property);
+        return (T)request.getProperty(property);
     }
 
     public <P extends Provider>P getProvider() {
-        return request.getProvider();
+        return (P)request.getProvider();
     }
 
     public Reader getReader() throws IOException {

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/CollectionRequestProcessor.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/CollectionRequestProcessor.java?rev=1173846&r1=1173845&r2=1173846&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/CollectionRequestProcessor.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/CollectionRequestProcessor.java
Wed Sep 21 20:51:43 2011
@@ -35,7 +35,7 @@ public abstract class CollectionRequestP
         if (collectionAdapter == null) {
             return (S)ProviderHelper.notfound(context);
         } else {
-            return this.processCollection(context, collectionAdapter);
+            return (S)this.processCollection(context, collectionAdapter);
         }
     }
 
@@ -44,7 +44,7 @@ public abstract class CollectionRequestP
         CollectionAdapter adapter) {
         String method = context.getMethod();
         if (method.equalsIgnoreCase("GET")) {
-            return adapter.getItemList(context);
+            return (S)adapter.getItemList(context);
         } else if (method.equalsIgnoreCase("POST")) {
             return (S)(isAcceptableItemType(context) ? adapter.postItem(context)
                 : adapter instanceof MediaCollectionAdapter ? ((MediaCollectionAdapter)adapter).postMedia(context)

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/CompressionFilter.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/CompressionFilter.java?rev=1173846&r1=1173845&r2=1173846&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/CompressionFilter.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/CompressionFilter.java
Wed Sep 21 20:51:43 2011
@@ -43,7 +43,7 @@ public class CompressionFilter implement
             } catch (Exception e) {
             }
         }
-        return chain.next(request);
+        return (S)chain.next(request);
     }
 
     /**

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/EntryRequestProcessor.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/EntryRequestProcessor.java?rev=1173846&r1=1173845&r2=1173846&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/EntryRequestProcessor.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/EntryRequestProcessor.java
Wed Sep 21 20:51:43 2011
@@ -32,28 +32,29 @@ public class EntryRequestProcessor
         if (collectionAdapter == null) {
             return (S)ProviderHelper.notfound(context);
         } else {
-            return this.processEntry(context, collectionAdapter);
+            return (S)this.processEntry(context, collectionAdapter);
         }
     }
 
+    @SuppressWarnings("unchecked")
     public <S extends ResponseContext>S processEntry(
         RequestContext context, 
         CollectionAdapter adapter) {
         String method = context.getMethod();
         if (method.equalsIgnoreCase("GET")) {
-            return adapter.getItem(context);
+            return (S)adapter.getItem(context);
         } else if (method.equalsIgnoreCase("POST")) {
-            return adapter.postItem(context);
+            return (S)adapter.postItem(context);
         } else if (method.equalsIgnoreCase("PUT")) {
-            return adapter.putItem(context);
+            return (S)adapter.putItem(context);
         } else if (method.equalsIgnoreCase("DELETE")) {
-            return adapter.deleteItem(context);
+            return (S)adapter.deleteItem(context);
         } else if (method.equalsIgnoreCase("HEAD")) {
-            return adapter.headItem(context);
+            return (S)adapter.headItem(context);
         } else if (method.equalsIgnoreCase("OPTIONS")) {
-            return adapter.optionsItem(context);
+            return (S)adapter.optionsItem(context);
         } else if (method.equalsIgnoreCase("PATCH") && adapter instanceof PatchAdapter)
{
-            return ((PatchAdapter)adapter).patchItem(context);
+            return (S)((PatchAdapter)adapter).patchItem(context);
         } else {
             return null;
         }

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/MediaRequestProcessor.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/MediaRequestProcessor.java?rev=1173846&r1=1173845&r2=1173846&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/MediaRequestProcessor.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/protocol/MediaRequestProcessor.java
Wed Sep 21 20:51:43 2011
@@ -33,7 +33,7 @@ public class MediaRequestProcessor
         if (collectionAdapter == null) {
             return (S)ProviderHelper.notfound(context);
         } else {
-            return this.processMedia(context, collectionAdapter);
+            return (S)this.processMedia(context, collectionAdapter);
         }
     }
 
@@ -44,19 +44,19 @@ public class MediaRequestProcessor
         if (adapter instanceof MediaCollectionAdapter) {
             MediaCollectionAdapter mcadapter = (MediaCollectionAdapter)adapter;
             if (method.equalsIgnoreCase("GET")) {
-                return mcadapter.getMedia(context);
+                return (S)mcadapter.getMedia(context);
             } else if (method.equalsIgnoreCase("POST")) {
-                return mcadapter.postMedia(context);
+                return (S)mcadapter.postMedia(context);
             } else if (method.equalsIgnoreCase("PUT")) {
-                return mcadapter.putMedia(context);
+                return (S)mcadapter.putMedia(context);
             } else if (method.equalsIgnoreCase("DELETE")) {
-                return mcadapter.deleteMedia(context);
+                return (S)mcadapter.deleteMedia(context);
             } else if (method.equalsIgnoreCase("HEAD")) {
-                return mcadapter.headMedia(context);
+                return (S)mcadapter.headMedia(context);
             } else if (method.equalsIgnoreCase("OPTIONS")) {
-                return mcadapter.optionsMedia(context);
+                return (S)mcadapter.optionsMedia(context);
             } else if (method.equalsIgnoreCase("PATCH") && mcadapter instanceof PatchMediaAdapter)
{
-                return ((PatchMediaAdapter)mcadapter).patchMedia(context);
+                return (S)((PatchMediaAdapter)mcadapter).patchMedia(context);
             } else {
                 return null;
             }

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/templates/DelegatingContext.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/templates/DelegatingContext.java?rev=1173846&r1=1173845&r2=1173846&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/templates/DelegatingContext.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/templates/DelegatingContext.java
Wed Sep 21 20:51:43 2011
@@ -50,7 +50,7 @@ public abstract class DelegatingContext 
     }
 
     public <T> T resolve(String var) {
-      return this.subcontext.resolve(var);
+      return (T)this.subcontext.resolve(var);
     }
 
     public void clear() {

Modified: abdera/abdera2/common/src/main/java/org/apache/abdera2/common/templates/MultiContext.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/common/src/main/java/org/apache/abdera2/common/templates/MultiContext.java?rev=1173846&r1=1173845&r2=1173846&view=diff
==============================================================================
--- abdera/abdera2/common/src/main/java/org/apache/abdera2/common/templates/MultiContext.java
(original)
+++ abdera/abdera2/common/src/main/java/org/apache/abdera2/common/templates/MultiContext.java
Wed Sep 21 20:51:43 2011
@@ -78,11 +78,12 @@ public class MultiContext 
     return names.iterator();
   }
 
+  @SuppressWarnings("unchecked")
   @Override
   protected <T> T resolveActual(String var) {
     for (Context context : contexts)
       if (context.contains(var))
-        return context.resolve(var);
+        return (T)context.resolve(var);
     return null;
   }
 



Mime
View raw message