public class JavaOnlyArray extends java.lang.Object implements ReadableArray, WritableArray
ArrayList backed implementation of ReadableArray and WritableArray
Instances of this class SHOULD NOT be used for communication between java and JS, use instances
of WritableNativeArray created via Arguments.createArray() or just ReadableArray interface if you want your "native" module method to take an array from JS as an
argument.
Main purpose for this class is to be used in java-only unit tests, but could also be used outside of tests in the code that operates only in java and needs to communicate with RN modules via their JS-exposed API.
| Constructor and Description |
|---|
JavaOnlyArray() |
| Modifier and Type | Method and Description |
|---|---|
static JavaOnlyArray |
deepClone(ReadableArray ary) |
boolean |
equals(java.lang.Object o) |
static JavaOnlyArray |
from(java.util.List list) |
ReadableArray |
getArray(int index) |
boolean |
getBoolean(int index) |
double |
getDouble(int index) |
Dynamic |
getDynamic(int index) |
int |
getInt(int index) |
ReadableMap |
getMap(int index) |
java.lang.String |
getString(int index) |
ReadableType |
getType(int index) |
int |
hashCode() |
boolean |
isNull(int index) |
static JavaOnlyArray |
of(java.lang.Object... values) |
void |
pushArray(ReadableArray array) |
void |
pushBoolean(boolean value) |
void |
pushDouble(double value) |
void |
pushInt(int value) |
void |
pushMap(ReadableMap map) |
void |
pushNull() |
void |
pushString(java.lang.String value) |
int |
size() |
java.util.ArrayList<java.lang.Object> |
toArrayList() |
java.lang.String |
toString() |
public static JavaOnlyArray from(java.util.List list)
public static JavaOnlyArray of(java.lang.Object... values)
public static JavaOnlyArray deepClone(ReadableArray ary)
public int size()
size in interface ReadableArraypublic boolean isNull(int index)
isNull in interface ReadableArraypublic double getDouble(int index)
getDouble in interface ReadableArraypublic int getInt(int index)
getInt in interface ReadableArraypublic java.lang.String getString(int index)
getString in interface ReadableArraypublic ReadableArray getArray(int index)
getArray in interface ReadableArraypublic boolean getBoolean(int index)
getBoolean in interface ReadableArraypublic ReadableMap getMap(int index)
getMap in interface ReadableArraypublic Dynamic getDynamic(int index)
getDynamic in interface ReadableArraypublic ReadableType getType(int index)
getType in interface ReadableArraypublic void pushBoolean(boolean value)
pushBoolean in interface WritableArraypublic void pushDouble(double value)
pushDouble in interface WritableArraypublic void pushInt(int value)
pushInt in interface WritableArraypublic void pushString(java.lang.String value)
pushString in interface WritableArraypublic void pushArray(ReadableArray array)
pushArray in interface WritableArraypublic void pushMap(ReadableMap map)
pushMap in interface WritableArraypublic void pushNull()
pushNull in interface WritableArraypublic java.util.ArrayList<java.lang.Object> toArrayList()
toArrayList in interface ReadableArraypublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object