]> source.dussan.org Git - gwtquery.git/commitdiff
Safe type casting
authorManolo Carrasco <manolo@apache.org>
Sat, 18 Jan 2014 12:29:56 +0000 (13:29 +0100)
committerManolo Carrasco <manolo@apache.org>
Sat, 18 Jan 2014 12:29:56 +0000 (13:29 +0100)
gwtquery-core/src/main/java/com/google/gwt/query/client/GQ.java
gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonFactory.java
gwtquery-core/src/main/java/com/google/gwt/query/vm/JsonFactoryJre.java

index 46cee7e1a0e1f78b1ad9bb0097fe545416ec3de5..27dbbe78623b14d74de9832677fc35cfb1b8a047 100644 (file)
@@ -44,9 +44,13 @@ public abstract class GQ {
     return ret;
   }
   
-  public static <T extends Binder> T create(String s) {
+  public static Binder create(String s) {
     return getFactory().create(s);
   }
+
+  public static Binder create() {
+    return getFactory().create();
+  }
   
   public static AjaxTransport getAjaxTransport() {
     if (ajaxTransport == null) {
index adcd5212c324aa0d41a150527bc849a954ca060c..4bc57c9c2e07b568bc09b0c492fef07675e7c34f 100644 (file)
@@ -4,5 +4,6 @@ import com.google.gwt.query.client.Binder;
 
 public interface JsonFactory {
   <T extends JsonBuilder> T create(Class<T> clz);
-  <T extends Binder> T create(String s);
+  Binder create(String s);
+  Binder create();
 }
index abef1b8f076798db5d6667b6e303ce3232e9ec23..d234d854284c9f02735fa45276680aaf66a1670b 100644 (file)
@@ -284,11 +284,16 @@ public class JsonFactoryJre implements JsonFactory  {
     InvocationHandler handler = new JsonBuilderHandler(jso);
     return (Binder)Proxy.newProxyInstance(Binder.class.getClassLoader(), new Class[] {Binder.class}, handler);
   }
-  
-  @SuppressWarnings("unchecked")
-  public <T extends Binder> T create(String s) {
+
+  @Override
+  public Binder create(String s) {
     Binder ret = createBinder();
     ret.parse(Properties.wrapPropertiesString(s));
-    return (T)ret;
+    return ret;
+  }
+
+  @Override
+  public Binder create() {
+    return createBinder();
   }
 }