Package com.google.gwt.core.client
Class JsArrayMixed
- java.lang.Object
-
- com.google.gwt.core.client.JavaScriptObject
-
- com.google.gwt.core.client.JsArrayMixed
-
public class JsArrayMixed extends JavaScriptObject
A simple wrapper around an heterogeneous native array of values. This class may not be directly instantiated, and can only be returned from a native method. For example,native JsArrayMixed getNativeArray() /*-{ return [ { x: 0, y: 1}, "apple", 12345, ]; }-* /;
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedJsArrayMixed()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetBoolean(int index)Gets the boolean at a given index.doublegetNumber(int index)Gets the double at a given index.<T extends JavaScriptObject>
TgetObject(int index)Gets theJavaScriptObjectat a given index.java.lang.StringgetString(int index)Gets the String at a given index.java.lang.Stringjoin()Convert each element of the array to a String and join them with a comma separator.java.lang.Stringjoin(java.lang.String separator)Convert each element of the array to a String and join them with a comma separator.intlength()Gets the length of the array.voidpush(boolean value)Pushes the given boolean onto the end of the array.voidpush(double value)Pushes the given double onto the end of the array.voidpush(JavaScriptObject value)Pushes the givenJavaScriptObjectonto the end of the array.voidpush(java.lang.String value)Pushes the given String onto the end of the array.voidset(int index, boolean value)Sets the boolean value at a given index.voidset(int index, double value)Sets the double value at a given index.voidset(int index, JavaScriptObject value)Sets the object value at a given index.voidset(int index, java.lang.String value)Sets the String value at a given index.voidsetLength(int newLength)Reset the length of the array.booleanshiftBoolean()Shifts the first value off the array.doubleshiftNumber()Shifts the first value off the array.<T extends JavaScriptObject>
TshiftObject()Shifts the first value off the array.java.lang.StringshiftString()Shifts the first value off the array.voidunshift(boolean value)Shifts a boolean onto the beginning of the array.voidunshift(double value)Shifts a double onto the beginning of the array.voidunshift(JavaScriptObject value)Shifts aJavaScriptObjectonto the beginning of the array.voidunshift(java.lang.String value)Shifts a String onto the beginning of the array.-
Methods inherited from class com.google.gwt.core.client.JavaScriptObject
cast, createArray, createArray, createFunction, createObject, equals, hashCode, toSource, toString
-
-
-
-
Method Detail
-
getBoolean
public final boolean getBoolean(int index)
Gets the boolean at a given index.- Parameters:
index- the index to be retrieved- Returns:
- the object at the given index coerced to boolean.
-
getNumber
public final double getNumber(int index)
Gets the double at a given index.- Parameters:
index- the index to be retrieved- Returns:
- the object at the given index coerced to number.
-
getObject
public final <T extends JavaScriptObject> T getObject(int index)
Gets theJavaScriptObjectat a given index.- Parameters:
index- the index to be retrieved- Returns:
- the
JavaScriptObjectat the given index, ornullif none exists
-
getString
public final java.lang.String getString(int index)
Gets the String at a given index.- Parameters:
index- the index to be retrieved- Returns:
- the object at the given index, or
nullif none exists
-
join
public final java.lang.String join()
Convert each element of the array to a String and join them with a comma separator. The value returned from this method may vary between browsers based on how JavaScript values are converted into strings.
-
join
public final java.lang.String join(java.lang.String separator)
Convert each element of the array to a String and join them with a comma separator. The value returned from this method may vary between browsers based on how JavaScript values are converted into strings.
-
length
public final int length()
Gets the length of the array.- Returns:
- the array length
-
push
public final void push(boolean value)
Pushes the given boolean onto the end of the array.
-
push
public final void push(double value)
Pushes the given double onto the end of the array.
-
push
public final void push(JavaScriptObject value)
Pushes the givenJavaScriptObjectonto the end of the array.
-
push
public final void push(java.lang.String value)
Pushes the given String onto the end of the array.
-
set
public final void set(int index, boolean value)Sets the boolean value at a given index. If the index is out of bounds, the value will still be set. The array's length will be updated to encompass the bounds implied by the added value.- Parameters:
index- the index to be setvalue- the boolean to be stored
-
set
public final void set(int index, double value)Sets the double value at a given index. If the index is out of bounds, the value will still be set. The array's length will be updated to encompass the bounds implied by the added value.- Parameters:
index- the index to be setvalue- the double to be stored
-
set
public final void set(int index, JavaScriptObject value)Sets the object value at a given index. If the index is out of bounds, the value will still be set. The array's length will be updated to encompass the bounds implied by the added object.- Parameters:
index- the index to be setvalue- theJavaScriptObjectto be stored
-
set
public final void set(int index, java.lang.String value)Sets the String value at a given index. If the index is out of bounds, the value will still be set. The array's length will be updated to encompass the bounds implied by the added String.- Parameters:
index- the index to be setvalue- the String to be stored
-
setLength
public final void setLength(int newLength)
Reset the length of the array.- Parameters:
newLength- the new length of the array
-
shiftBoolean
public final boolean shiftBoolean()
Shifts the first value off the array.- Returns:
- the shifted item coerced to a boolean
-
shiftNumber
public final double shiftNumber()
Shifts the first value off the array.- Returns:
- the shifted item coerced to a number
-
shiftObject
public final <T extends JavaScriptObject> T shiftObject()
Shifts the first value off the array.- Returns:
- the shifted
JavaScriptObject
-
shiftString
public final java.lang.String shiftString()
Shifts the first value off the array.- Returns:
- the shifted String
-
unshift
public final void unshift(boolean value)
Shifts a boolean onto the beginning of the array.- Parameters:
value- the value to the stored
-
unshift
public final void unshift(double value)
Shifts a double onto the beginning of the array.- Parameters:
value- the value to store
-
unshift
public final void unshift(JavaScriptObject value)
Shifts aJavaScriptObjectonto the beginning of the array.- Parameters:
value- the value to store
-
unshift
public final void unshift(java.lang.String value)
Shifts a String onto the beginning of the array.- Parameters:
value- the value to store
-
-