public class MVCArray<T extends JavaScriptObject> extends MVCObject<T>
Modifier | Constructor and Description |
---|---|
protected |
MVCArray()
This class extends MVCObject.
|
Modifier and Type | Method and Description |
---|---|
HandlerRegistration |
addInsertAtHandler(InsertAtMapHandler handler)
This event is fired when insertAt() is called.
|
HandlerRegistration |
addRemoveAtHandler(RemoveAtMapHandler handler)
This event is fired when removeAt() is called.
|
HandlerRegistration |
addSetAtHandler(SetAtMapHandler handler)
This event is fired when setAt() is called.
|
void |
clear()
Removes all elements from the array.
|
void |
forEach(MVCArrayCallback<T> callback)
Iterate over each element, calling the provided callback.
|
T |
get(int index)
Get an element at the specified index.
|
JsArray<T> |
getArray()
Returns a reference to the underlying Array.
|
int |
getLength()
Returns the number of elements in this array.
|
void |
insertAt(int index,
T element)
Inserts an element at the specified index.
|
static <T extends JavaScriptObject> |
newInstance()
A mutable MVC Array.
|
static <T extends JavaScriptObject> |
newInstance(JsArray<T> array)
A mutable MVC Array.
|
static <T extends JavaScriptObject> |
newInstance(T... array)
A mutable MVC Array.
|
T |
pop()
Removes the last element of the array and returns that element.
|
int |
push(T element)
Adds one element to the end of the array and returns the new length of the array.
|
T |
removeAt(int index)
Removes an element from the specified index.
|
void |
setAt(int index,
T element)
Sets an element at the specified index.
|
bindTo, bindTo, bindTo, changed, createInstanceOfMVCObject, get, notify, set, setValues, unbind, unbindAll
cast, createArray, createFunction, createObject, equals, hashCode, toSource, toString
public static final <T extends JavaScriptObject> MVCArray<T> newInstance()
public static final <T extends JavaScriptObject> MVCArray<T> newInstance(JsArray<T> array)
array
- public static final <T extends JavaScriptObject> MVCArray<T> newInstance(T... array)
array
- one ore more objects (like T[] or T)public final void clear()
public final void forEach(MVCArrayCallback<T> callback)
callback
- public final JsArray<T> getArray()
public final T get(int index)
index
- public final int getLength()
public final void insertAt(int index, T element)
index
- element
- public final T pop()
public final int push(T element)
element
- public final T removeAt(int index)
index
- public final void setAt(int index, T element)
index
- element
- public final HandlerRegistration addInsertAtHandler(InsertAtMapHandler handler)
handler
- public final HandlerRegistration addRemoveAtHandler(RemoveAtMapHandler handler)
handler
- public final HandlerRegistration addSetAtHandler(SetAtMapHandler handler)
handler
- Copyright © 2011-2013 Gone Vertical LLC. All Rights Reserved.