GWT 2.7.0

com.google.gwt.core.client
Class JsArrayUtils

java.lang.Object
  extended by com.google.gwt.core.client.JsArrayUtils

public class JsArrayUtils
extends java.lang.Object

Utility class for manipulating JS arrays. These methods are not on other JavaScriptObject subclasses, such as JsArray, because adding new methods might break existing subtypes.


Method Summary
static JsArrayInteger readOnlyJsArray(byte[] array)
          Take a Java array, and produce a JS array that is only used for reading.
static JsArrayNumber readOnlyJsArray(double[] array)
          Take a Java array, and produce a JS array that is only used for reading.
static JsArrayNumber readOnlyJsArray(float[] array)
          Take a Java array, and produce a JS array that is only used for reading.
static JsArrayInteger readOnlyJsArray(int[] array)
          Take a Java array, and produce a JS array that is only used for reading.
static JsArrayNumber readOnlyJsArray(long[] array)
          Take a Java array, and produce a JS array that is only used for reading.
static JsArrayInteger readOnlyJsArray(short[] array)
          Take a Java array, and produce a JS array that is only used for reading.
static
<T extends JavaScriptObject>
JsArray<T>
readOnlyJsArray(T[] array)
          Take a Java array, and produce a JS array that is only used for reading.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readOnlyJsArray

public static JsArrayInteger readOnlyJsArray(byte[] array)
Take a Java array, and produce a JS array that is only used for reading. As this is actually a reference to the original array in prod mode, the source must not be modified while this copy is in use or you will get different behavior between DevMode and prod mode.

Parameters:
array - source array
Returns:
JS array, which may be a copy or an alias of the input array

readOnlyJsArray

public static JsArrayNumber readOnlyJsArray(double[] array)
Take a Java array, and produce a JS array that is only used for reading. As this is actually a reference to the original array in prod mode, the source must not be modified while this copy is in use or you will get different behavior between DevMode and prod mode.

Parameters:
array - source array
Returns:
JS array, which may be a copy or an alias of the input array

readOnlyJsArray

public static JsArrayNumber readOnlyJsArray(float[] array)
Take a Java array, and produce a JS array that is only used for reading. As this is actually a reference to the original array in prod mode, the source must not be modified while this copy is in use or you will get different behavior between DevMode and prod mode.

Parameters:
array - source array
Returns:
JS array, which may be a copy or an alias of the input array

readOnlyJsArray

public static JsArrayInteger readOnlyJsArray(int[] array)
Take a Java array, and produce a JS array that is only used for reading. As this is actually a reference to the original array in prod mode, the source must not be modified while this copy is in use or you will get different behavior between DevMode and prod mode.

Parameters:
array - source array
Returns:
JS array, which may be a copy or an alias of the input array

readOnlyJsArray

public static JsArrayNumber readOnlyJsArray(long[] array)
Take a Java array, and produce a JS array that is only used for reading. As this is actually a reference to the original array in prod mode, the source must not be modified while this copy is in use or you will get different behavior between DevMode and prod mode.

NOTE: long values are not supported in JS, so long emulation is slow and this method assumes that all the values can be safely stored in a double.

Parameters:
array - source array - its values are assumed to be in the valid range for doubles -- if the values exceed 2^53, low-order bits will be lost
Returns:
JS array, which may be a copy or an alias of the input array

readOnlyJsArray

public static JsArrayInteger readOnlyJsArray(short[] array)
Take a Java array, and produce a JS array that is only used for reading. As this is actually a reference to the original array in prod mode, the source must not be modified while this copy is in use or you will get different behavior between DevMode and prod mode.

Parameters:
array - source array
Returns:
JS array, which may be a copy or an alias of the input array

readOnlyJsArray

public static <T extends JavaScriptObject> JsArray<T> readOnlyJsArray(T[] array)
Take a Java array, and produce a JS array that is only used for reading. As this is actually a reference to the original array in prod mode, the source must not be modified while this copy is in use or you will get different behavior between DevMode and prod mode.

Parameters:
array - source array
Returns:
JS array, which may be a copy or an alias of the input array

GWT 2.7.0