public class JavaOnlyArray extends java.lang.Object implements ReadableArray, WritableArray
ArrayList
backed impementation 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 |
---|---|
boolean |
equals(java.lang.Object o) |
static JavaOnlyArray |
from(java.util.List list) |
JavaOnlyArray |
getArray(int index) |
boolean |
getBoolean(int index) |
double |
getDouble(int index) |
int |
getInt(int index) |
JavaOnlyMap |
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(WritableArray array) |
void |
pushBoolean(boolean value) |
void |
pushDouble(double value) |
void |
pushInt(int value) |
void |
pushMap(WritableMap map) |
void |
pushNull() |
void |
pushString(java.lang.String value) |
int |
size() |
java.lang.String |
toString() |
public static JavaOnlyArray from(java.util.List list)
public static JavaOnlyArray of(java.lang.Object... values)
public int size()
size
in interface ReadableArray
public boolean isNull(int index)
isNull
in interface ReadableArray
public double getDouble(int index)
getDouble
in interface ReadableArray
public int getInt(int index)
getInt
in interface ReadableArray
public java.lang.String getString(int index)
getString
in interface ReadableArray
public JavaOnlyArray getArray(int index)
getArray
in interface ReadableArray
public boolean getBoolean(int index)
getBoolean
in interface ReadableArray
public JavaOnlyMap getMap(int index)
getMap
in interface ReadableArray
public ReadableType getType(int index)
getType
in interface ReadableArray
public void pushBoolean(boolean value)
pushBoolean
in interface WritableArray
public void pushDouble(double value)
pushDouble
in interface WritableArray
public void pushInt(int value)
pushInt
in interface WritableArray
public void pushString(java.lang.String value)
pushString
in interface WritableArray
public void pushArray(WritableArray array)
pushArray
in interface WritableArray
public void pushMap(WritableMap map)
pushMap
in interface WritableArray
public void pushNull()
pushNull
in interface WritableArray
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object