当前位置: 首页>>代码示例>>Java>>正文


Java ReadableMap.keySetIterator方法代码示例

本文整理汇总了Java中com.facebook.react.bridge.ReadableMap.keySetIterator方法的典型用法代码示例。如果您正苦于以下问题:Java ReadableMap.keySetIterator方法的具体用法?Java ReadableMap.keySetIterator怎么用?Java ReadableMap.keySetIterator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.facebook.react.bridge.ReadableMap的用法示例。


在下文中一共展示了ReadableMap.keySetIterator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createIntent

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
private Intent createIntent(String action, ReadableMap extra) {
  final Intent intent = new Intent(action);
  for (
    ReadableMapKeySetIterator it = extra.keySetIterator();
    it.hasNextKey();
  ) {
    String key = it.nextKey();
    ReadableType type = extra.getType(key);
    switch(type) {
      case Null:
        break;
      case Boolean:
        intent.putExtra(key, extra.getBoolean(key));
        break;
      case Number:
        intent.putExtra(key, extra.getInt(key));
        break;
      case String:
        intent.putExtra(key, extra.getString(key));
        break;
      default:
        throw new IllegalArgumentException("Unsupported type " + type);
    }
  }
  return intent;
}
 
开发者ID:de-code,项目名称:react-native-android-speech-recognizer,代码行数:27,代码来源:RNAndroidSpeechRecognizerModule.java

示例2: toMap

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
/**
 * toMap converts a {@link ReadableMap} into a HashMap.
 *
 * @param readableMap The ReadableMap to be converted.
 * @return A HashMap containing the data that was in the ReadableMap.
 */
public static Map<String, Object> toMap(@Nullable ReadableMap readableMap) {
    if (readableMap == null) {
        return null;
    }

    com.facebook.react.bridge.ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
    if (!iterator.hasNextKey()) {
        return null;
    }

    Map<String, Object> result = new HashMap<>();
    while (iterator.hasNextKey()) {
        String key = iterator.nextKey();
        result.put(key, toObject(readableMap, key));
    }

    return result;
}
 
开发者ID:hudl,项目名称:react-native-android-fragment,代码行数:25,代码来源:ReactUtil.java

示例3: parseConstraints

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
/**
 * Parses a constraint set specified in the form of a JavaScript object into
 * a specific <tt>List</tt> of <tt>MediaConstraints.KeyValuePair</tt>s.
 *
 * @param src The constraint set in the form of a JavaScript object to
 * parse.
 * @param dst The <tt>List</tt> of <tt>MediaConstraints.KeyValuePair</tt>s
 * into which the specified <tt>src</tt> is to be parsed.
 */
private void parseConstraints(
        ReadableMap src,
        List<MediaConstraints.KeyValuePair> dst) {
    ReadableMapKeySetIterator keyIterator = src.keySetIterator();

    while (keyIterator.hasNextKey()) {
        String key = keyIterator.nextKey();
        String value = ReactBridgeUtil.getMapStrValue(src, key);

        dst.add(new MediaConstraints.KeyValuePair(key, value));
    }
}
 
开发者ID:angellsl10,项目名称:react-native-webrtc,代码行数:22,代码来源:WebRTCModule.java

示例4: toJSONObject

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
public static JSONObject toJSONObject(ReadableMap readableMap) throws JSONException {
  JSONObject jsonObject = new JSONObject();

  ReadableMapKeySetIterator iterator = readableMap.keySetIterator();

  while (iterator.hasNextKey()) {
    String key = iterator.nextKey();
    ReadableType type = readableMap.getType(key);

    switch (type) {
      case Null:
        jsonObject.put(key, null);
        break;
      case Boolean:
        jsonObject.put(key, readableMap.getBoolean(key));
        break;
      case Number:
        jsonObject.put(key, readableMap.getDouble(key));
        break;
      case String:
        jsonObject.put(key, readableMap.getString(key));
        break;
      case Map:
        jsonObject.put(key, MapUtil.toJSONObject(readableMap.getMap(key)));
        break;
      case Array:
        jsonObject.put(key, ArrayUtil.toJSONArray(readableMap.getArray(key)));
        break;
    }
  }

  return jsonObject;
}
 
开发者ID:davidstoneham,项目名称:react-native-mssql,代码行数:34,代码来源:MapUtil.java

示例5: convertMapToJson

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
private static JSONObject convertMapToJson(ReadableMap readableMap) throws JSONException {
  JSONObject object = new JSONObject();
  ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
  while (iterator.hasNextKey()) {
    String key = iterator.nextKey();
    switch (readableMap.getType(key)) {
      case Null:
        object.put(key, JSONObject.NULL);
        break;
      case Boolean:
        object.put(key, readableMap.getBoolean(key));
        break;
      case Number:
        object.put(key, readableMap.getDouble(key));
        break;
      case String:
        object.put(key, readableMap.getString(key));
        break;
      case Map:
        object.put(key, convertMapToJson(readableMap.getMap(key)));
        break;
      case Array:
        object.put(key, convertArrayToJson(readableMap.getArray(key)));
        break;
    }
  }
  return object;
}
 
开发者ID:humaniq,项目名称:react-native-android-library-humaniq-api,代码行数:29,代码来源:ModelConverterUtils.java

示例6: updateProps

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
public static <T extends ViewManager, V extends View> void updateProps(
    T manager,
    V v,
    ReactStylesDiffMap props) {
  ViewManagerSetter<T, V> setter = findManagerSetter(manager.getClass());
  ReadableMap propMap = props.mBackingMap;
  ReadableMapKeySetIterator iterator = propMap.keySetIterator();
  while (iterator.hasNextKey()) {
    String key = iterator.nextKey();
    setter.setProperty(manager, v, key, props);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:13,代码来源:ViewManagerPropertyUpdater.java

示例7: PropsAnimatedNode

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
PropsAnimatedNode(ReadableMap config, NativeAnimatedNodesManager nativeAnimatedNodesManager) {
  ReadableMap props = config.getMap("props");
  ReadableMapKeySetIterator iter = props.keySetIterator();
  mPropMapping = new HashMap<>();
  while (iter.hasNextKey()) {
    String propKey = iter.nextKey();
    int nodeIndex = props.getInt(propKey);
    mPropMapping.put(propKey, nodeIndex);
  }
  mNativeAnimatedNodesManager = nativeAnimatedNodesManager;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:12,代码来源:PropsAnimatedNode.java

示例8: toJSONObject

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
public static JSONObject toJSONObject(ReadableMap readableMap) throws JSONException {
    JSONObject jsonObject = new JSONObject();

    ReadableMapKeySetIterator iterator = readableMap.keySetIterator();

    while (iterator.hasNextKey()) {
        String key = iterator.nextKey();
        ReadableType type = readableMap.getType(key);

        switch (type) {
            case Null:
                jsonObject.put(key, null);
                break;
            case Boolean:
                jsonObject.put(key, readableMap.getBoolean(key));
                break;
            case Number:
                jsonObject.put(key, readableMap.getDouble(key));
                break;
            case String:
                jsonObject.put(key, readableMap.getString(key));
                break;
            case Map:
                jsonObject.put(key, MapUtil.toJSONObject(readableMap.getMap(key)));
                break;
            case Array:
                jsonObject.put(key, ArrayUtil.toJSONArray(readableMap.getArray(key)));
                break;
        }
    }

    return jsonObject;
}
 
开发者ID:dangerfarms,项目名称:react-native-batch,代码行数:34,代码来源:MapUtil.java

示例9: toMap

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
public static Map<String, Object> toMap(ReadableMap readableMap) {
    Map<String, Object> map = new HashMap<>();
    ReadableMapKeySetIterator iterator = readableMap.keySetIterator();

    while (iterator.hasNextKey()) {
        String key = iterator.nextKey();
        ReadableType type = readableMap.getType(key);

        switch (type) {
            case Null:
                map.put(key, null);
                break;
            case Boolean:
                map.put(key, readableMap.getBoolean(key));
                break;
            case Number:
                map.put(key, readableMap.getDouble(key));
                break;
            case String:
                map.put(key, readableMap.getString(key));
                break;
            case Map:
                map.put(key, MapUtil.toMap(readableMap.getMap(key)));
                break;
            case Array:
                map.put(key, ArrayUtil.toArray(readableMap.getArray(key)));
                break;
        }
    }

    return map;
}
 
开发者ID:dangerfarms,项目名称:react-native-batch,代码行数:33,代码来源:MapUtil.java

示例10: getQueryKeys

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
private List<String> getQueryKeys(ReadableMap query) {
    List<String> keys = new ArrayList<>();
    ReadableMapKeySetIterator iterator = query.keySetIterator();
    while(iterator.hasNextKey()) {
        keys.add(iterator.nextKey());
    }
    return keys;
}
 
开发者ID:reneweb,项目名称:rnrecord,代码行数:9,代码来源:FindCommand.java

示例11: getHeaders

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
private Map<String, String> getHeaders(ReadableMap readableMap) {
  if (readableMap == null) {
      return null;
  }
  ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
  Map<String, String> map = new HashMap<>();
  while (iterator.hasNextKey()) {
    String key = iterator.nextKey();
    String value = readableMap.getString(key);
    map.put(key, value);
  }
  return map;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:14,代码来源:ReactOkHttpNetworkFetcher.java

示例12: convertMapToJson

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
public static JSONObject convertMapToJson(ReadableMap readableMap) throws JSONException {
    JSONObject object = new JSONObject();
    ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
    while (iterator.hasNextKey()) {
        String key = iterator.nextKey();
        switch (readableMap.getType(key)) {
            case Null:
                object.put(key, JSONObject.NULL);
                break;
            case Boolean:
                object.put(key, readableMap.getBoolean(key));
                break;
            case Number:
                object.put(key, readableMap.getDouble(key));
                break;
            case String:
                object.put(key, readableMap.getString(key));
                break;
            case Map:
                object.put(key, convertMapToJson(readableMap.getMap(key)));
                break;
            case Array:
                object.put(key, convertArrayToJson(readableMap.getArray(key)));
                break;
        }
    }
    return object;
}
 
开发者ID:salathegroup,项目名称:react-native-scandit,代码行数:29,代码来源:ReactBridgeHelpers.java

示例13: setSource

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
@ReactProp(name = "source")
public void setSource(WebView view, @Nullable ReadableMap source) {
  if (source != null) {
    if (source.hasKey("html")) {
      String html = source.getString("html");
      if (source.hasKey("baseUrl")) {
        view.loadDataWithBaseURL(
            source.getString("baseUrl"), html, HTML_MIME_TYPE, HTML_ENCODING, null);
      } else {
        view.loadData(html, HTML_MIME_TYPE, HTML_ENCODING);
      }
      return;
    }
    if (source.hasKey("uri")) {
      String url = source.getString("uri");
      String previousUrl = view.getUrl();
      if (previousUrl != null && previousUrl.equals(url)) {
        return;
      }
      if (source.hasKey("method")) {
        String method = source.getString("method");
        if (method.equals(HTTP_METHOD_POST)) {
          byte[] postData = null;
          if (source.hasKey("body")) {
            String body = source.getString("body");
            try {
              postData = body.getBytes("UTF-8");
            } catch (UnsupportedEncodingException e) {
              postData = body.getBytes();
            }
          }
          if (postData == null) {
            postData = new byte[0];
          }
          view.postUrl(url, postData);
          return;
        }
      }
      HashMap<String, String> headerMap = new HashMap<>();
      if (source.hasKey("headers")) {
        ReadableMap headers = source.getMap("headers");
        ReadableMapKeySetIterator iter = headers.keySetIterator();
        while (iter.hasNextKey()) {
          String key = iter.nextKey();
          if ("user-agent".equals(key.toLowerCase(Locale.ENGLISH))) {
            if (view.getSettings() != null) {
              view.getSettings().setUserAgentString(headers.getString(key));
            }
          } else {
            headerMap.put(key, headers.getString(key));
          }
        }
      }
      view.loadUrl(url, headerMap);
      return;
    }
  }
  view.loadUrl(BLANK_URL);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:60,代码来源:ReactWebViewManager.java

示例14: readableMapToJson

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
public static JSONObject readableMapToJson(ReadableMap readableMap) {
    JSONObject jsonObject = new JSONObject();

    if (readableMap == null) {
        return null;
    }

    ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
    if (!iterator.hasNextKey()) {
        return null;
    }

    while (iterator.hasNextKey()) {
        String key = iterator.nextKey();
        ReadableType readableType = readableMap.getType(key);

        try {
            switch (readableType) {
                case Null:
                    jsonObject.put(key, null);
                    break;
                case Boolean:
                    jsonObject.put(key, readableMap.getBoolean(key));
                    break;
                case Number:
                    // Can be int or double.
                    jsonObject.put(key, readableMap.getInt(key));
                    break;
                case String:
                    jsonObject.put(key, readableMap.getString(key));
                    break;
                case Map:
                    jsonObject.put(key, readableMapToJson(readableMap.getMap(key)));
                    break;
                case Array:
                    jsonObject.put(key, readableMap.getArray(key));
                default:
                    // Do nothing and fail silently
            }
        } catch (JSONException ex) {
            // Do nothing and fail silently
        }
    }

    return jsonObject;
}
 
开发者ID:2534290808,项目名称:react-native-pili-live,代码行数:47,代码来源:Jsons.java

示例15: matches

import com.facebook.react.bridge.ReadableMap; //导入方法依赖的package包/类
/**
 * User to find notifications:
 * <p>
 * https://github.com/facebook/react-native/blob/master/Libraries/PushNotificationIOS/RCTPushNotificationManager.m#L294
 *
 * @param userInfo map of fields to match
 * @return true all fields in userInfo object match, false otherwise
 */
public boolean matches(ReadableMap userInfo) {
    Bundle bundle = toBundle();

    ReadableMapKeySetIterator iterator = userInfo.keySetIterator();
    while (iterator.hasNextKey()) {
        String key = iterator.nextKey();

        if (!bundle.containsKey(key))
            return false;

        switch (userInfo.getType(key)) {
            case Null: {
                if (bundle.get(key) != null)
                    return false;
                break;
            }
            case Boolean: {
                if (userInfo.getBoolean(key) != bundle.getBoolean(key))
                    return false;
                break;
            }
            case Number: {
                if ((userInfo.getDouble(key) != bundle.getDouble(key)) && (userInfo.getInt(key) != bundle.getInt(key)))
                    return false;
                break;
            }
            case String: {
                if (!userInfo.getString(key).equals(bundle.getString(key)))
                    return false;
                break;
            }
            case Map:
                return false;//there are no maps in the bundle
            case Array:
                return false;//there are no arrays in the bundle
        }
    }

    return true;
}
 
开发者ID:zzzkk2009,项目名称:react-native-leancloud-sdk,代码行数:49,代码来源:RNPushNotificationAttributes.java


注:本文中的com.facebook.react.bridge.ReadableMap.keySetIterator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。