aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManolo Carrasco <manolo@apache.org>2014-01-18 13:29:56 +0100
committerManolo Carrasco <manolo@apache.org>2014-01-18 13:29:56 +0100
commit5a56b36ba5fa3d912375f85f2ac5ed66e2eef108 (patch)
tree46053f3ed88930e2a2120128bd3561c1fce48aad
parent9ff6b89b9ee8da3c7afc8713eb52a3e998ded4f4 (diff)
downloadgwtquery-5a56b36ba5fa3d912375f85f2ac5ed66e2eef108.tar.gz
gwtquery-5a56b36ba5fa3d912375f85f2ac5ed66e2eef108.zip
Safe type casting
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/GQ.java6
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonFactory.java3
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/vm/JsonFactoryJre.java13
3 files changed, 16 insertions, 6 deletions
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQ.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQ.java
index 46cee7e1..27dbbe78 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQ.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQ.java
@@ -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) {
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonFactory.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonFactory.java
index adcd5212..4bc57c9c 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonFactory.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/builders/JsonFactory.java
@@ -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();
}
diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/vm/JsonFactoryJre.java b/gwtquery-core/src/main/java/com/google/gwt/query/vm/JsonFactoryJre.java
index abef1b8f..d234d854 100644
--- a/gwtquery-core/src/main/java/com/google/gwt/query/vm/JsonFactoryJre.java
+++ b/gwtquery-core/src/main/java/com/google/gwt/query/vm/JsonFactoryJre.java
@@ -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();
}
}