com.facebook.react.bridge.NoSuchKeyException Java Examples
The following examples show how to use
com.facebook.react.bridge.NoSuchKeyException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CatalystNativeJSToJavaParametersTestCase.java From react-native-GPay with MIT License | 5 votes |
private void assertNoSuchKeyExceptionThrown( ReadableMap map, String key, String typeToAskFor) { boolean gotException = false; try { mapGetByType(map, key, typeToAskFor); } catch (NoSuchKeyException expected) { gotException = true; } assertTrue(gotException); }
Example #2
Source File: SQLitePluginConverter.java From react-native-sqlite-storage with MIT License | 5 votes |
/** * Returns the value at {@code key} if it exists, coercing it if * necessary. */ static String getString(ReadableMap map, String key, String defaultValue) { if (map == null){ return defaultValue; } try { ReadableType type = map.getType(key); switch (type) { case Number: double value = map.getDouble(key); if (value == (long) value) { return String.valueOf((long) value); } else { return String.valueOf(value); } case Boolean: return String.valueOf(map.getBoolean(key)); case String: return map.getString(key); case Null: return null; default: return defaultValue; } } catch(NoSuchKeyException ex){ return defaultValue; } }
Example #3
Source File: SQLitePluginConverter.java From react-native-sqlite-storage with MIT License | 5 votes |
/** * Returns the value at {@code index} if it exists, coercing it if * necessary. */ static String getString(ReadableArray array, int index, String defaultValue) { if (array == null){ return defaultValue; } try { ReadableType type = array.getType(index); switch (type) { case Number: double value = array.getDouble(index); if (value == (long) value) { return String.valueOf((long) value); } else { return String.valueOf(value); } case Boolean: return String.valueOf(array.getBoolean(index)); case String: return array.getString(index); case Null: return null; default: return defaultValue; } } catch(NoSuchKeyException ex){ return defaultValue; } }
Example #4
Source File: SQLitePluginConverter.java From react-native-sqlite-storage with MIT License | 5 votes |
static Object get(ReadableMap map,String key,Object defaultValue){ if (map == null){ return defaultValue; } try { Object value = null; ReadableType type = map.getType(key); switch(type){ case Boolean: value = map.getBoolean(key); break; case Number: value = map.getDouble(key); break; case String: value = map.getString(key); break; case Map: value = map.getMap(key); break; case Array: value = map.getArray(key); break; case Null: value = null; break; } return value; } catch (NoSuchKeyException ex){ return defaultValue; } }
Example #5
Source File: SQLitePluginConverter.java From react-native-sqlite-storage with MIT License | 5 votes |
static Object get(ReadableArray array,int index,Object defaultValue){ if (array == null){ return defaultValue; } try { Object value = null; ReadableType type = array.getType(index); switch(type){ case Boolean: value = array.getBoolean(index); break; case Number: value = array.getDouble(index); break; case String: value = array.getString(index); break; case Map: value = array.getMap(index); break; case Array: value = array.getArray(index); break; case Null: break; } return value; } catch (NoSuchKeyException ex){ return defaultValue; } }
Example #6
Source File: SQLitePluginConverter.java From react-native-sqlite-storage with MIT License | 5 votes |
/** * Returns the value at {@code key} if it exists, coercing it if * necessary. */ static String getString(ReadableMap map, String key, String defaultValue) { if (map == null){ return defaultValue; } try { ReadableType type = map.getType(key); switch (type) { case Number: double value = map.getDouble(key); if (value == (long) value) { return String.valueOf((long) value); } else { return String.valueOf(value); } case Boolean: return String.valueOf(map.getBoolean(key)); case String: return map.getString(key); case Null: return null; default: return defaultValue; } } catch(NoSuchKeyException ex){ return defaultValue; } }
Example #7
Source File: SQLitePluginConverter.java From react-native-sqlite-storage with MIT License | 5 votes |
/** * Returns the value at {@code index} if it exists, coercing it if * necessary. */ static String getString(ReadableArray array, int index, String defaultValue) { if (array == null){ return defaultValue; } try { ReadableType type = array.getType(index); switch (type) { case Number: double value = array.getDouble(index); if (value == (long) value) { return String.valueOf((long) value); } else { return String.valueOf(value); } case Boolean: return String.valueOf(array.getBoolean(index)); case String: return array.getString(index); case Null: return null; default: return defaultValue; } } catch(NoSuchKeyException ex){ return defaultValue; } }
Example #8
Source File: SQLitePluginConverter.java From react-native-sqlite-storage with MIT License | 5 votes |
static Object get(ReadableMap map,String key,Object defaultValue){ if (map == null){ return defaultValue; } try { Object value = null; ReadableType type = map.getType(key); switch(type){ case Boolean: value = map.getBoolean(key); break; case Number: value = map.getDouble(key); break; case String: value = map.getString(key); break; case Map: value = map.getMap(key); break; case Array: value = map.getArray(key); break; case Null: value = null; break; } return value; } catch (NoSuchKeyException ex){ return defaultValue; } }
Example #9
Source File: SQLitePluginConverter.java From react-native-sqlite-storage with MIT License | 5 votes |
static Object get(ReadableArray array,int index,Object defaultValue){ if (array == null){ return defaultValue; } try { Object value = null; ReadableType type = array.getType(index); switch(type){ case Boolean: value = array.getBoolean(index); break; case Number: value = array.getDouble(index); break; case String: value = array.getString(index); break; case Map: value = array.getMap(index); break; case Array: value = array.getArray(index); break; case Null: break; } return value; } catch (NoSuchKeyException ex){ return defaultValue; } }
Example #10
Source File: Utils.java From react-native-update with MIT License | 5 votes |
public static String tryGetString(ReadableMap map, String key) { try { return map.getString(key); } catch (NoSuchKeyException e) { return null; } }