From 30352ce90c8bded13ad5129ac03f2c2a32949a21 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Manuel=20Carrasco=20Mo=C3=B1ino?= Date: Mon, 27 Jan 2014 21:02:58 +0000 Subject: [PATCH] javadoc in GQ class --- .../java/com/google/gwt/query/client/GQ.java | 54 +++++++++++++++---- 1 file changed, 43 insertions(+), 11 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 ea2fcce3..292321b8 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 @@ -23,35 +23,58 @@ import com.google.gwt.query.client.plugins.ajax.AjaxTransportJs; import com.google.gwt.query.vm.AjaxTransportJre; import com.google.gwt.query.vm.JsonFactoryJre; +/** + * A set of useful methods for gQuery which can be run in browser or JVM. + */ public abstract class GQ { - private static JsonFactory jsonFactory; private static AjaxTransport ajaxTransport; + + private static JsonFactory jsonFactory; + + public static IsProperties create() { + return getFactory().create(); + } + /** + * Create an instance of a JsonBuilder object whose type is + */ public static T create(Class clz) { return getFactory().create(clz); } - public static T create(Class clz, String payload) { + /** + * Create an instance of a JsonBuilder object whose type is + * and set the the underlying properties object. + */ + public static T create(Class clz, IsProperties obj) { T ret = create(clz); - ret.load(payload); + ret.load(obj.getDataImpl()); return ret; } - - public static T create(Class clz, IsProperties obj) { + + /** + * Create an instance of a JsonBuilder object whose type is + * and load all its properties from a json string. + */ + public static T create(Class clz, String payload) { T ret = create(clz); - ret.load(obj.getDataImpl()); + ret.load(payload); return ret; } + /** + * Create an instance of IsProperties. Normally a Properties javascript + * object in client side, or a proxy object in the JVM + */ public static IsProperties create(String s) { return getFactory().create(s); } - - public static IsProperties create() { - return getFactory().create(); - } + /** + * Return the appropriate transport implementation depending on the runtime + * environment: browser or JVM + */ public static AjaxTransport getAjaxTransport() { if (ajaxTransport == null) { ajaxTransport = GWT.isClient() ? @@ -60,7 +83,7 @@ public abstract class GQ { } return ajaxTransport; } - + private static JsonFactory getFactory() { if (jsonFactory == null) { jsonFactory = GWT.isClient() ? @@ -69,4 +92,13 @@ public abstract class GQ { } return jsonFactory; } + + /** + * Change the default Ajax transport by a customized one, useful for + * testing purposes. + */ + public static void setAjaxTransport(AjaxTransport transport) { + ajaxTransport = transport; + } + } -- 2.39.5