Modified:
/trunk/gwt-rpc-plus/codegen/com/dotspots/rpcplus/codegen/jscollections/CollectionGen.java
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcList.java
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListBool.java
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListDouble.java
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListInt.java
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListLong.java
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListString.java
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapInt.java
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapIntBool.java
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapIntDouble.java
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapIntInt.java
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapIntLong.java
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapIntString.java
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapString.java
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapStringBool.java
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapStringDouble.java
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapStringInt.java
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapStringLong.java
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapStringString.java
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcSetInt.java
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcSetString.java
=======================================
---
/trunk/gwt-rpc-plus/codegen/com/dotspots/rpcplus/codegen/jscollections/CollectionGen.java
Thu Apr 8 15:55:27 2010
+++
/trunk/gwt-rpc-plus/codegen/com/dotspots/rpcplus/codegen/jscollections/CollectionGen.java
Tue Apr 13 19:15:47 2010
@@ -5,6 +5,9 @@
import java.io.PrintWriter;
import java.lang.reflect.Array;
+import com.dotspots.rpcplus.client.jscollections.RpcUtils;
+import com.google.gwt.core.client.JavaScriptObject;
+
/**
* Generates a set of strongly-typed and generic GWT collections for use
with Thrift.
*
@@ -86,20 +89,29 @@
return getName(clazz);
}
- private String getDefault(Class<?> clazz) {
+ private String getSafeSetter(Class<?> clazz) {
+ if (clazz == long.class) {
+ return "@" + RpcUtils.class.getName() + "::toDoubles(J)(value)";
+ }
+
+ return "value";
+ }
+
+ private String getSafeGetter(Class<?> clazz) {
if (clazz == int.class || clazz == double.class) {
- return "0";
+ return "%s || 0";
}
if (clazz == boolean.class) {
- return "false";
+ return "!!%s";
}
if (clazz == long.class) {
- return "[0,0]";
+ return "@" + RpcUtils.class.getName() + "::fromDoubles(L" +
JavaScriptObject.class.getName().replace('.', '/')
+ + ";)(%s || [0,0])";
}
- return "null";
+ return "%s || null";
}
private void writeList(Class<?> elem) throws FileNotFoundException {
@@ -191,7 +203,8 @@
String keyBinaryName = getBinaryName(key);
String indexer = (key == String.class) ? "['_' + idx]" : "[idx]";
String keyString = (key == String.class) ? "'_' + idx" : "idx";
- String defaultValue = getDefault(value);
+ String safeGetter = getSafeGetter(value);
+ String safeSetter = getSafeSetter(value);
try {
printWriter.println("// AUTOGENERATED: See " + getClass().getName() + "
for more details");
@@ -199,6 +212,7 @@
printWriter.println();
printWriter.println("import
com.google.gwt.core.client.JavaScriptObject;");
+ printWriter.println("import
com.google.gwt.core.client.UnsafeNativeLong;");
printWriter.println("import com.google.gwt.core.client.GWT;");
printWriter.println("import com.google.gwt.lang.LongLib;");
printWriter.println();
@@ -334,71 +348,73 @@
}
if (getter) {
- if (value == long.class) {
- printWriter.println(" public " + valueType + " get(" +
key.getSimpleName() + " idx) {");
- printWriter.println(" return
RpcUtils.fromDoubles(get0(idx));");
- printWriter.println(" };");
- printWriter.println();
-
- printWriter.println(" private native JavaScriptObject get0(" +
key.getSimpleName() + " idx) /*-{");
- printWriter.println(" return this" + indexer + " || [0,0];");
- printWriter.println(" }-*/;");
- } else {
- printWriter.println(" public native " + valueType + " get(" +
key.getSimpleName() + " idx) /*-{");
- if (value == boolean.class) {
- printWriter.println(" // Coerce to boolean in case underlying
value is integer");
- printWriter.println(" return !!this" + indexer + ";");
- } else {
- printWriter.println(" return this" + indexer + " || " +
defaultValue + ";");
- }
- printWriter.println(" }-*/;");
- }
+ printWriter.println(" @UnsafeNativeLong");
+ printWriter.println(" public native " + valueType + " get(" +
key.getSimpleName() + " idx) /*-{");
+ printWriter.println(" return " +
String.format(safeGetter, "this" + indexer) + ";");
+ printWriter.println(" }-*/;");
printWriter.println();
- if (value == long.class) {
- printWriter.println(" public void set(" + key.getSimpleName() + "
idx, " + valueType + " value) {");
- printWriter.println(" set0(idx, RpcUtils.toDoubles(value));");
- printWriter.println(" }");
- printWriter.println();
-
- printWriter.println(" private native void set0(" +
key.getSimpleName() + " idx, JavaScriptObject value) /*-{");
- printWriter.println(" this" + indexer + " = value;");
- printWriter.println(" }-*/;");
- } else {
- printWriter.println(" public native void set(" +
key.getSimpleName() + " idx, " + valueType + " value) /*-{");
- printWriter.println(" this" + indexer + " = value;");
- printWriter.println(" }-*/;");
- }
+ printWriter.println(" @UnsafeNativeLong");
+ printWriter.println(" public native void set(" +
key.getSimpleName() + " idx, " + valueType + " value) /*-{");
+ printWriter.println(" this" + indexer + " = " + safeSetter
+ ";");
+ printWriter.println(" }-*/;");
printWriter.println();
}
if (type == Type.LIST) {
- if (value == long.class) {
- printWriter.println(" public void add(" + valueType + " value) {");
- printWriter.println(" add0(RpcUtils.toDoubles(value));");
- printWriter.println(" }");
- printWriter.println();
-
- printWriter.println(" private native void add0(JavaScriptObject
value) /*-{");
- printWriter.println(" this.push(value);");
- printWriter.println(" }-*/;");
- } else {
- printWriter.println(" public native void add(" + valueType + "
value) /*-{");
- printWriter.println(" this.push(value);");
- printWriter.println(" }-*/;");
- }
+ printWriter.println(" /**");
+ printWriter.println(" * Adds an item to the end of the list,
returning the list's new size.");
+ printWriter.println(" */");
+ printWriter.println(" @UnsafeNativeLong");
+ printWriter.println(" public native int add(" + valueType + "
value) /*-{");
+ printWriter.println(" return this.push(" + safeSetter + ");");
+ printWriter.println(" }-*/;");
+ printWriter.println();
+
+ printWriter.println(" /**");
+ printWriter.println(" * Adds an item to the end of the list,
returning the list's new size.");
+ printWriter.println(" */");
+ printWriter.println(" @UnsafeNativeLong");
+ printWriter.println(" public native int push(" + valueType + "
value) /*-{");
+ printWriter.println(" return this.push(" + safeSetter + ");");
+ printWriter.println(" }-*/;");
printWriter.println();
- printWriter.println(" public native void pop() /*-{");
- printWriter.println(" this.pop();");
+ printWriter.println(" /**");
+ printWriter.println(" * Pops an item off the end of the list,
returning it.");
+ printWriter.println(" */");
+ printWriter.println(" @UnsafeNativeLong");
+ printWriter.println(" public native " + valueType + " pop() /*-{");
+ printWriter.println(" return " +
String.format(safeGetter, "this.pop()") + ";");
printWriter.println(" }-*/;");
printWriter.println();
+ printWriter.println(" /**");
+ printWriter.println(" * Peeks at the item at the end of the
list.");
+ printWriter.println(" */");
printWriter.println(" public " + valueType + " peek() {");
printWriter.println(" return this.get(this.size() - 1);");
printWriter.println(" };");
printWriter.println();
+ printWriter.println(" /**");
+ printWriter.println(" * Unshifts an item into position 0,
returning the new size of the list.");
+ printWriter.println(" */");
+ printWriter.println(" @UnsafeNativeLong");
+ printWriter.println(" public native int unshift(" + valueType + "
value) /*-{");
+ printWriter.println(" return this.unshift(" + safeSetter
+ ");");
+ printWriter.println(" }-*/;");
+ printWriter.println();
+
+ printWriter.println(" /**");
+ printWriter.println(" * Shifts an item out of position 0 and
returns it.");
+ printWriter.println(" */");
+ printWriter.println(" @UnsafeNativeLong");
+ printWriter.println(" public native " + valueType + " shift()
/*-{");
+ printWriter.println(" return " +
String.format(safeGetter, "this.shift()") + ";");
+ printWriter.println(" }-*/;");
+ printWriter.println();
+
printWriter.println(" public native String join(String separator)
/*-{");
printWriter.println(" return this.join(separator);");
printWriter.println(" }-*/;");
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcList.java
Thu Apr 8 15:55:27 2010
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcList.java
Tue Apr 13 19:15:47 2010
@@ -2,6 +2,7 @@
package com.dotspots.rpcplus.client.jscollections;
import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.UnsafeNativeLong;
import com.google.gwt.core.client.GWT;
import com.google.gwt.lang.LongLib;
@@ -44,26 +45,63 @@
return true;
};
+ @UnsafeNativeLong
public native E get(int idx) /*-{
return this[idx] || null;
}-*/;
+ @UnsafeNativeLong
public native void set(int idx, E value) /*-{
this[idx] = value;
}-*/;
- public native void add(E value) /*-{
- this.push(value);
+ /**
+ * Adds an item to the end of the list, returning the list's new size.
+ */
+ @UnsafeNativeLong
+ public native int add(E value) /*-{
+ return this.push(value);
}-*/;
- public native void pop() /*-{
- this.pop();
+ /**
+ * Adds an item to the end of the list, returning the list's new size.
+ */
+ @UnsafeNativeLong
+ public native int push(E value) /*-{
+ return this.push(value);
}-*/;
+ /**
+ * Pops an item off the end of the list, returning it.
+ */
+ @UnsafeNativeLong
+ public native E pop() /*-{
+ return this.pop() || null;
+ }-*/;
+
+ /**
+ * Peeks at the item at the end of the list.
+ */
public E peek() {
return this.get(this.size() - 1);
};
+ /**
+ * Unshifts an item into position 0, returning the new size of the
list.
+ */
+ @UnsafeNativeLong
+ public native int unshift(E value) /*-{
+ return this.unshift(value);
+ }-*/;
+
+ /**
+ * Shifts an item out of position 0 and returns it.
+ */
+ @UnsafeNativeLong
+ public native E shift() /*-{
+ return this.shift() || null;
+ }-*/;
+
public native String join(String separator) /*-{
return this.join(separator);
}-*/;
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListBool.java
Thu Apr 8 15:55:27 2010
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListBool.java
Tue Apr 13 19:15:47 2010
@@ -2,6 +2,7 @@
package com.dotspots.rpcplus.client.jscollections;
import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.UnsafeNativeLong;
import com.google.gwt.core.client.GWT;
import com.google.gwt.lang.LongLib;
@@ -44,27 +45,63 @@
return true;
};
+ @UnsafeNativeLong
public native boolean get(int idx) /*-{
- // Coerce to boolean in case underlying value is integer
return !!this[idx];
}-*/;
+ @UnsafeNativeLong
public native void set(int idx, boolean value) /*-{
this[idx] = value;
}-*/;
- public native void add(boolean value) /*-{
- this.push(value);
+ /**
+ * Adds an item to the end of the list, returning the list's new size.
+ */
+ @UnsafeNativeLong
+ public native int add(boolean value) /*-{
+ return this.push(value);
}-*/;
- public native void pop() /*-{
- this.pop();
+ /**
+ * Adds an item to the end of the list, returning the list's new size.
+ */
+ @UnsafeNativeLong
+ public native int push(boolean value) /*-{
+ return this.push(value);
}-*/;
+ /**
+ * Pops an item off the end of the list, returning it.
+ */
+ @UnsafeNativeLong
+ public native boolean pop() /*-{
+ return !!this.pop();
+ }-*/;
+
+ /**
+ * Peeks at the item at the end of the list.
+ */
public boolean peek() {
return this.get(this.size() - 1);
};
+ /**
+ * Unshifts an item into position 0, returning the new size of the
list.
+ */
+ @UnsafeNativeLong
+ public native int unshift(boolean value) /*-{
+ return this.unshift(value);
+ }-*/;
+
+ /**
+ * Shifts an item out of position 0 and returns it.
+ */
+ @UnsafeNativeLong
+ public native boolean shift() /*-{
+ return !!this.shift();
+ }-*/;
+
public native String join(String separator) /*-{
return this.join(separator);
}-*/;
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListDouble.java
Thu Apr 8 15:55:27 2010
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListDouble.java
Tue Apr 13 19:15:47 2010
@@ -2,6 +2,7 @@
package com.dotspots.rpcplus.client.jscollections;
import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.UnsafeNativeLong;
import com.google.gwt.core.client.GWT;
import com.google.gwt.lang.LongLib;
@@ -44,26 +45,63 @@
return true;
};
+ @UnsafeNativeLong
public native double get(int idx) /*-{
return this[idx] || 0;
}-*/;
+ @UnsafeNativeLong
public native void set(int idx, double value) /*-{
this[idx] = value;
}-*/;
- public native void add(double value) /*-{
- this.push(value);
+ /**
+ * Adds an item to the end of the list, returning the list's new size.
+ */
+ @UnsafeNativeLong
+ public native int add(double value) /*-{
+ return this.push(value);
}-*/;
- public native void pop() /*-{
- this.pop();
+ /**
+ * Adds an item to the end of the list, returning the list's new size.
+ */
+ @UnsafeNativeLong
+ public native int push(double value) /*-{
+ return this.push(value);
}-*/;
+ /**
+ * Pops an item off the end of the list, returning it.
+ */
+ @UnsafeNativeLong
+ public native double pop() /*-{
+ return this.pop() || 0;
+ }-*/;
+
+ /**
+ * Peeks at the item at the end of the list.
+ */
public double peek() {
return this.get(this.size() - 1);
};
+ /**
+ * Unshifts an item into position 0, returning the new size of the
list.
+ */
+ @UnsafeNativeLong
+ public native int unshift(double value) /*-{
+ return this.unshift(value);
+ }-*/;
+
+ /**
+ * Shifts an item out of position 0 and returns it.
+ */
+ @UnsafeNativeLong
+ public native double shift() /*-{
+ return this.shift() || 0;
+ }-*/;
+
public native String join(String separator) /*-{
return this.join(separator);
}-*/;
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListInt.java
Thu Apr 8 15:55:27 2010
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListInt.java
Tue Apr 13 19:15:47 2010
@@ -2,6 +2,7 @@
package com.dotspots.rpcplus.client.jscollections;
import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.UnsafeNativeLong;
import com.google.gwt.core.client.GWT;
import com.google.gwt.lang.LongLib;
@@ -44,26 +45,63 @@
return true;
};
+ @UnsafeNativeLong
public native int get(int idx) /*-{
return this[idx] || 0;
}-*/;
+ @UnsafeNativeLong
public native void set(int idx, int value) /*-{
this[idx] = value;
}-*/;
- public native void add(int value) /*-{
- this.push(value);
+ /**
+ * Adds an item to the end of the list, returning the list's new size.
+ */
+ @UnsafeNativeLong
+ public native int add(int value) /*-{
+ return this.push(value);
}-*/;
- public native void pop() /*-{
- this.pop();
+ /**
+ * Adds an item to the end of the list, returning the list's new size.
+ */
+ @UnsafeNativeLong
+ public native int push(int value) /*-{
+ return this.push(value);
}-*/;
+ /**
+ * Pops an item off the end of the list, returning it.
+ */
+ @UnsafeNativeLong
+ public native int pop() /*-{
+ return this.pop() || 0;
+ }-*/;
+
+ /**
+ * Peeks at the item at the end of the list.
+ */
public int peek() {
return this.get(this.size() - 1);
};
+ /**
+ * Unshifts an item into position 0, returning the new size of the
list.
+ */
+ @UnsafeNativeLong
+ public native int unshift(int value) /*-{
+ return this.unshift(value);
+ }-*/;
+
+ /**
+ * Shifts an item out of position 0 and returns it.
+ */
+ @UnsafeNativeLong
+ public native int shift() /*-{
+ return this.shift() || 0;
+ }-*/;
+
public native String join(String separator) /*-{
return this.join(separator);
}-*/;
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListLong.java
Thu Nov 19 00:39:34 2009
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListLong.java
Tue Apr 13 19:15:47 2010
@@ -2,6 +2,7 @@
package com.dotspots.rpcplus.client.jscollections;
import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.UnsafeNativeLong;
import com.google.gwt.core.client.GWT;
import com.google.gwt.lang.LongLib;
@@ -30,38 +31,63 @@
this.splice(idx, 1);
}-*/;
- public long get(int idx) {
- return RpcUtils.fromDoubles(get0(idx));
- };
-
- private native JavaScriptObject get0(int idx) /*-{
- return this[idx] || [0,0];
+ @UnsafeNativeLong
+ public native long get(int idx) /*-{
+ return
@com.dotspots.rpcplus.client.jscollections.RpcUtils::fromDoubles(Lcom/google/gwt/core/client/JavaScriptObject;)(this[idx]
|| [0,0]);
+ }-*/;
+
+ @UnsafeNativeLong
+ public native void set(int idx, long value) /*-{
+ this[idx] =
@com.dotspots.rpcplus.client.jscollections.RpcUtils::toDoubles(J)(value);
}-*/;
- public void set(int idx, long value) {
- set0(idx, RpcUtils.toDoubles(value));
- }
-
- private native void set0(int idx, JavaScriptObject value) /*-{
- this[idx] = value;
+ /**
+ * Adds an item to the end of the list, returning the list's new size.
+ */
+ @UnsafeNativeLong
+ public native int add(long value) /*-{
+ return
this.push(@com.dotspots.rpcplus.client.jscollections.RpcUtils::toDoubles(J)(value));
}-*/;
- public void add(long value) {
- add0(RpcUtils.toDoubles(value));
- }
-
- private native void add0(JavaScriptObject value) /*-{
- this.push(value);
+ /**
+ * Adds an item to the end of the list, returning the list's new size.
+ */
+ @UnsafeNativeLong
+ public native int push(long value) /*-{
+ return
this.push(@com.dotspots.rpcplus.client.jscollections.RpcUtils::toDoubles(J)(value));
}-*/;
- public native void pop() /*-{
- this.pop();
+ /**
+ * Pops an item off the end of the list, returning it.
+ */
+ @UnsafeNativeLong
+ public native long pop() /*-{
+ return
@com.dotspots.rpcplus.client.jscollections.RpcUtils::fromDoubles(Lcom/google/gwt/core/client/JavaScriptObject;)(this.pop()
|| [0,0]);
}-*/;
+ /**
+ * Peeks at the item at the end of the list.
+ */
public long peek() {
return this.get(this.size() - 1);
};
+ /**
+ * Unshifts an item into position 0, returning the new size of the
list.
+ */
+ @UnsafeNativeLong
+ public native int unshift(long value) /*-{
+ return
this.unshift(@com.dotspots.rpcplus.client.jscollections.RpcUtils::toDoubles(J)(value));
+ }-*/;
+
+ /**
+ * Shifts an item out of position 0 and returns it.
+ */
+ @UnsafeNativeLong
+ public native long shift() /*-{
+ return
@com.dotspots.rpcplus.client.jscollections.RpcUtils::fromDoubles(Lcom/google/gwt/core/client/JavaScriptObject;)(this.shift()
|| [0,0]);
+ }-*/;
+
public native String join(String separator) /*-{
return this.join(separator);
}-*/;
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListString.java
Thu Apr 8 15:55:27 2010
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcListString.java
Tue Apr 13 19:15:47 2010
@@ -2,6 +2,7 @@
package com.dotspots.rpcplus.client.jscollections;
import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.UnsafeNativeLong;
import com.google.gwt.core.client.GWT;
import com.google.gwt.lang.LongLib;
@@ -44,26 +45,63 @@
return true;
};
+ @UnsafeNativeLong
public native String get(int idx) /*-{
return this[idx] || null;
}-*/;
+ @UnsafeNativeLong
public native void set(int idx, String value) /*-{
this[idx] = value;
}-*/;
- public native void add(String value) /*-{
- this.push(value);
+ /**
+ * Adds an item to the end of the list, returning the list's new size.
+ */
+ @UnsafeNativeLong
+ public native int add(String value) /*-{
+ return this.push(value);
}-*/;
- public native void pop() /*-{
- this.pop();
+ /**
+ * Adds an item to the end of the list, returning the list's new size.
+ */
+ @UnsafeNativeLong
+ public native int push(String value) /*-{
+ return this.push(value);
}-*/;
+ /**
+ * Pops an item off the end of the list, returning it.
+ */
+ @UnsafeNativeLong
+ public native String pop() /*-{
+ return this.pop() || null;
+ }-*/;
+
+ /**
+ * Peeks at the item at the end of the list.
+ */
public String peek() {
return this.get(this.size() - 1);
};
+ /**
+ * Unshifts an item into position 0, returning the new size of the
list.
+ */
+ @UnsafeNativeLong
+ public native int unshift(String value) /*-{
+ return this.unshift(value);
+ }-*/;
+
+ /**
+ * Shifts an item out of position 0 and returns it.
+ */
+ @UnsafeNativeLong
+ public native String shift() /*-{
+ return this.shift() || null;
+ }-*/;
+
public native String join(String separator) /*-{
return this.join(separator);
}-*/;
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapInt.java
Thu Nov 19 00:39:34 2009
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapInt.java
Tue Apr 13 19:15:47 2010
@@ -2,6 +2,7 @@
package com.dotspots.rpcplus.client.jscollections;
import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.UnsafeNativeLong;
import com.google.gwt.core.client.GWT;
import com.google.gwt.lang.LongLib;
@@ -64,10 +65,12 @@
delete this[idx];
}-*/;
+ @UnsafeNativeLong
public native E get(int idx) /*-{
return this[idx] || null;
}-*/;
+ @UnsafeNativeLong
public native void set(int idx, E value) /*-{
this[idx] = value;
}-*/;
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapIntBool.java
Thu Nov 19 00:39:34 2009
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapIntBool.java
Tue Apr 13 19:15:47 2010
@@ -2,6 +2,7 @@
package com.dotspots.rpcplus.client.jscollections;
import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.UnsafeNativeLong;
import com.google.gwt.core.client.GWT;
import com.google.gwt.lang.LongLib;
@@ -60,11 +61,12 @@
delete this[idx];
}-*/;
+ @UnsafeNativeLong
public native boolean get(int idx) /*-{
- // Coerce to boolean in case underlying value is integer
return !!this[idx];
}-*/;
+ @UnsafeNativeLong
public native void set(int idx, boolean value) /*-{
this[idx] = value;
}-*/;
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapIntDouble.java
Thu Nov 19 00:39:34 2009
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapIntDouble.java
Tue Apr 13 19:15:47 2010
@@ -2,6 +2,7 @@
package com.dotspots.rpcplus.client.jscollections;
import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.UnsafeNativeLong;
import com.google.gwt.core.client.GWT;
import com.google.gwt.lang.LongLib;
@@ -60,10 +61,12 @@
delete this[idx];
}-*/;
+ @UnsafeNativeLong
public native double get(int idx) /*-{
return this[idx] || 0;
}-*/;
+ @UnsafeNativeLong
public native void set(int idx, double value) /*-{
this[idx] = value;
}-*/;
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapIntInt.java
Thu Nov 19 00:39:34 2009
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapIntInt.java
Tue Apr 13 19:15:47 2010
@@ -2,6 +2,7 @@
package com.dotspots.rpcplus.client.jscollections;
import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.UnsafeNativeLong;
import com.google.gwt.core.client.GWT;
import com.google.gwt.lang.LongLib;
@@ -60,10 +61,12 @@
delete this[idx];
}-*/;
+ @UnsafeNativeLong
public native int get(int idx) /*-{
return this[idx] || 0;
}-*/;
+ @UnsafeNativeLong
public native void set(int idx, int value) /*-{
this[idx] = value;
}-*/;
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapIntLong.java
Thu Nov 19 00:39:34 2009
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapIntLong.java
Tue Apr 13 19:15:47 2010
@@ -2,6 +2,7 @@
package com.dotspots.rpcplus.client.jscollections;
import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.UnsafeNativeLong;
import com.google.gwt.core.client.GWT;
import com.google.gwt.lang.LongLib;
@@ -33,20 +34,14 @@
delete this[idx];
}-*/;
- public long get(int idx) {
- return RpcUtils.fromDoubles(get0(idx));
- };
-
- private native JavaScriptObject get0(int idx) /*-{
- return this[idx] || [0,0];
+ @UnsafeNativeLong
+ public native long get(int idx) /*-{
+ return
@com.dotspots.rpcplus.client.jscollections.RpcUtils::fromDoubles(Lcom/google/gwt/core/client/JavaScriptObject;)(this[idx]
|| [0,0]);
}-*/;
- public void set(int idx, long value) {
- set0(idx, RpcUtils.toDoubles(value));
- }
-
- private native void set0(int idx, JavaScriptObject value) /*-{
- this[idx] = value;
+ @UnsafeNativeLong
+ public native void set(int idx, long value) /*-{
+ this[idx] =
@com.dotspots.rpcplus.client.jscollections.RpcUtils::toDoubles(J)(value);
}-*/;
}
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapIntString.java
Thu Nov 19 00:39:34 2009
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapIntString.java
Tue Apr 13 19:15:47 2010
@@ -2,6 +2,7 @@
package com.dotspots.rpcplus.client.jscollections;
import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.UnsafeNativeLong;
import com.google.gwt.core.client.GWT;
import com.google.gwt.lang.LongLib;
@@ -64,10 +65,12 @@
delete this[idx];
}-*/;
+ @UnsafeNativeLong
public native String get(int idx) /*-{
return this[idx] || null;
}-*/;
+ @UnsafeNativeLong
public native void set(int idx, String value) /*-{
this[idx] = value;
}-*/;
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapString.java
Thu Nov 19 00:39:34 2009
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapString.java
Tue Apr 13 19:15:47 2010
@@ -2,6 +2,7 @@
package com.dotspots.rpcplus.client.jscollections;
import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.UnsafeNativeLong;
import com.google.gwt.core.client.GWT;
import com.google.gwt.lang.LongLib;
@@ -64,10 +65,12 @@
delete this['_' + idx];
}-*/;
+ @UnsafeNativeLong
public native E get(String idx) /*-{
return this['_' + idx] || null;
}-*/;
+ @UnsafeNativeLong
public native void set(String idx, E value) /*-{
this['_' + idx] = value;
}-*/;
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapStringBool.java
Thu Nov 19 00:39:34 2009
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapStringBool.java
Tue Apr 13 19:15:47 2010
@@ -2,6 +2,7 @@
package com.dotspots.rpcplus.client.jscollections;
import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.UnsafeNativeLong;
import com.google.gwt.core.client.GWT;
import com.google.gwt.lang.LongLib;
@@ -60,11 +61,12 @@
delete this['_' + idx];
}-*/;
+ @UnsafeNativeLong
public native boolean get(String idx) /*-{
- // Coerce to boolean in case underlying value is integer
return !!this['_' + idx];
}-*/;
+ @UnsafeNativeLong
public native void set(String idx, boolean value) /*-{
this['_' + idx] = value;
}-*/;
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapStringDouble.java
Thu Nov 19 00:39:34 2009
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapStringDouble.java
Tue Apr 13 19:15:47 2010
@@ -2,6 +2,7 @@
package com.dotspots.rpcplus.client.jscollections;
import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.UnsafeNativeLong;
import com.google.gwt.core.client.GWT;
import com.google.gwt.lang.LongLib;
@@ -60,10 +61,12 @@
delete this['_' + idx];
}-*/;
+ @UnsafeNativeLong
public native double get(String idx) /*-{
return this['_' + idx] || 0;
}-*/;
+ @UnsafeNativeLong
public native void set(String idx, double value) /*-{
this['_' + idx] = value;
}-*/;
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapStringInt.java
Thu Nov 19 00:39:34 2009
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapStringInt.java
Tue Apr 13 19:15:47 2010
@@ -2,6 +2,7 @@
package com.dotspots.rpcplus.client.jscollections;
import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.UnsafeNativeLong;
import com.google.gwt.core.client.GWT;
import com.google.gwt.lang.LongLib;
@@ -60,10 +61,12 @@
delete this['_' + idx];
}-*/;
+ @UnsafeNativeLong
public native int get(String idx) /*-{
return this['_' + idx] || 0;
}-*/;
+ @UnsafeNativeLong
public native void set(String idx, int value) /*-{
this['_' + idx] = value;
}-*/;
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapStringLong.java
Thu Nov 19 00:39:34 2009
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapStringLong.java
Tue Apr 13 19:15:47 2010
@@ -2,6 +2,7 @@
package com.dotspots.rpcplus.client.jscollections;
import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.UnsafeNativeLong;
import com.google.gwt.core.client.GWT;
import com.google.gwt.lang.LongLib;
@@ -33,20 +34,14 @@
delete this['_' + idx];
}-*/;
- public long get(String idx) {
- return RpcUtils.fromDoubles(get0(idx));
- };
-
- private native JavaScriptObject get0(String idx) /*-{
- return this['_' + idx] || [0,0];
+ @UnsafeNativeLong
+ public native long get(String idx) /*-{
+ return
@com.dotspots.rpcplus.client.jscollections.RpcUtils::fromDoubles(Lcom/google/gwt/core/client/JavaScriptObject;)(this['_'
+ idx] || [0,0]);
}-*/;
- public void set(String idx, long value) {
- set0(idx, RpcUtils.toDoubles(value));
- }
-
- private native void set0(String idx, JavaScriptObject value) /*-{
- this['_' + idx] = value;
+ @UnsafeNativeLong
+ public native void set(String idx, long value) /*-{
+ this['_' + idx] =
@com.dotspots.rpcplus.client.jscollections.RpcUtils::toDoubles(J)(value);
}-*/;
}
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapStringString.java
Thu Nov 19 00:39:34 2009
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcMapStringString.java
Tue Apr 13 19:15:47 2010
@@ -2,6 +2,7 @@
package com.dotspots.rpcplus.client.jscollections;
import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.UnsafeNativeLong;
import com.google.gwt.core.client.GWT;
import com.google.gwt.lang.LongLib;
@@ -64,10 +65,12 @@
delete this['_' + idx];
}-*/;
+ @UnsafeNativeLong
public native String get(String idx) /*-{
return this['_' + idx] || null;
}-*/;
+ @UnsafeNativeLong
public native void set(String idx, String value) /*-{
this['_' + idx] = value;
}-*/;
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcSetInt.java
Thu Nov 19 00:39:34 2009
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcSetInt.java
Tue Apr 13 19:15:47 2010
@@ -2,6 +2,7 @@
package com.dotspots.rpcplus.client.jscollections;
import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.UnsafeNativeLong;
import com.google.gwt.core.client.GWT;
import com.google.gwt.lang.LongLib;
=======================================
---
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcSetString.java
Thu Nov 19 00:39:34 2009
+++
/trunk/gwt-rpc-plus/gwt/com/dotspots/rpcplus/client/jscollections/JsRpcSetString.java
Tue Apr 13 19:15:47 2010
@@ -2,6 +2,7 @@
package com.dotspots.rpcplus.client.jscollections;
import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.UnsafeNativeLong;
import com.google.gwt.core.client.GWT;
import com.google.gwt.lang.LongLib;