import com.google.gwt.core.client.JsArray;
import com.google.gwt.query.client.IsProperties;
import com.google.gwt.query.client.Properties;
+ import com.google.gwt.query.client.js.JsCache;
import com.google.gwt.query.client.js.JsObjectArray;
import com.google.gwt.query.client.js.JsUtils;
+ import com.google.gwt.user.client.Window;
+
+ import java.util.Arrays;
+ import java.util.List;
+/**
+ * Common class for all JsonBuilder implementations.
+ *
+ * @param <J>
+ */
public abstract class JsonBuilderBase<J extends JsonBuilderBase<?>> implements JsonBuilder {
protected Properties p = Properties.create();
}
/**
- * Check is a javascript object can be cast to an Element
+ * Check is a javascript object can be cast to an Element.
*/
public static native boolean isElement(Object o) /*-{
- return o && o.nodeType && o.nodeName ? true : false;
+ return !!o && 'nodeType' in o && 'nodeName' in o;
}-*/;
/**
* It uses java.util.reflect.Proxy to implement JsonBuilders
* and elemental light weight json to handle json data.
*/
-public class JsonFactoryJre implements JsonFactory {
+public class JsonFactoryJre implements JsonFactory {
- static JsonFactoryJre jsonFactory = new JsonFactoryJre();
+
/**
* Although functions cannot be serialized to json we use JsonBuilders