-
public class Arguments
-
-
Method Summary
Modifier and Type Method Description static WritableNativeArray
makeNativeArray(List objects)
This method converts a List into a NativeArray. static <T> WritableNativeArray
makeNativeArray(Object objects)
This overload is like the above, but uses reflection to operate on any primitive or objecttype. static WritableNativeMap
makeNativeMap(Map<String, Object> objects)
This method converts a Map into a NativeMap. static WritableNativeMap
makeNativeMap(Bundle bundle)
Like the above, but takes a Bundle instead of a Map. static WritableArray
createArray()
This method should be used when you need to stub out creating NativeArrays in unit tests. static WritableMap
createMap()
This method should be used when you need to stub out creating NativeMaps in unit tests. static WritableNativeArray
fromJavaArgs(Array<Object> args)
static WritableArray
fromArray(Object array)
Convert an array to a WritableArray. static WritableArray
fromList(List list)
Convert a List to a WritableArray. static WritableMap
fromBundle(Bundle bundle)
Convert a Bundle to a WritableMap. static ArrayList
toList(@Nullable() ReadableArray readableArray)
Convert a WritableArray to a ArrayList. static Bundle
toBundle(@Nullable() ReadableMap readableMap)
Convert a WritableMap to a Bundle. -
-
Method Detail
-
makeNativeArray
static WritableNativeArray makeNativeArray(List objects)
This method converts a List into a NativeArray. The data types supported are boolean, int,float, double, and String. List, Map, and Bundle objects, as well as arrays, containing valuesof the above types and/or null, or any recursive arrangement of these, are also supported. Thebest way to think of this is a way to generate a Java representation of a json list, from Javatypes which have a natural representation in json.
-
makeNativeArray
static <T> WritableNativeArray makeNativeArray(Object objects)
This overload is like the above, but uses reflection to operate on any primitive or objecttype.
-
makeNativeMap
static WritableNativeMap makeNativeMap(Map<String, Object> objects)
This method converts a Map into a NativeMap. Value types are supported as with makeNativeArray.The best way to think of this is a way to generate a Java representation of a json object, fromJava types which have a natural representation in json.
-
makeNativeMap
static WritableNativeMap makeNativeMap(Bundle bundle)
Like the above, but takes a Bundle instead of a Map.
-
createArray
static WritableArray createArray()
This method should be used when you need to stub out creating NativeArrays in unit tests.
-
createMap
static WritableMap createMap()
This method should be used when you need to stub out creating NativeMaps in unit tests.
-
fromJavaArgs
static WritableNativeArray fromJavaArgs(Array<Object> args)
-
fromArray
static WritableArray fromArray(Object array)
Convert an array to a WritableArray.
- Parameters:
array
- the array to convert.
-
fromList
static WritableArray fromList(List list)
Convert a List to a WritableArray.
- Parameters:
list
- the list to convert.
-
fromBundle
static WritableMap fromBundle(Bundle bundle)
Convert a Bundle to a WritableMap. Supported key types in the bundle are:
- Parameters:
bundle
- the Bundle to convert
-
toList
@Nullable() static ArrayList toList(@Nullable() ReadableArray readableArray)
Convert a WritableArray to a ArrayList.
- Parameters:
readableArray
- the WritableArray to convert.
-
toBundle
@Nullable() static Bundle toBundle(@Nullable() ReadableMap readableMap)
Convert a WritableMap to a Bundle. Note: Each array is converted to an .
- Parameters:
readableMap
- the WritableMap to convert.
-
-
-
-