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


Java ReadableMapKeySetIterator.nextKey方法代码示例

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


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

示例1: testMapIterateOverNestedMaps

import com.facebook.react.bridge.ReadableMapKeySetIterator; //导入方法依赖的package包/类
public void testMapIterateOverNestedMaps() {
  mCatalystInstance.getJSModule(TestJSToJavaParametersModule.class).returnNestedMap();
  waitForBridgeAndUIIdle();

  List<ReadableMap> calls = mRecordingTestModule.getMapCalls();
  assertEquals(1, calls.size());
  ReadableNativeMap map = (ReadableNativeMap) calls.get(0);
  assertNotNull(map);

  ReadableMapKeySetIterator firstLevelIterator = map.keySetIterator();
  String firstLevelKey = firstLevelIterator.nextKey();
  assertEquals(firstLevelKey, "weHaveToGoDeeper");

  ReadableNativeMap secondMap = map.getMap("weHaveToGoDeeper");
  ReadableMapKeySetIterator secondLevelIterator = secondMap.keySetIterator();
  String secondLevelKey = secondLevelIterator.nextKey();
  assertEquals(secondLevelKey, "inception");
  assertTrue(secondMap.getBoolean(secondLevelKey));
}
 
开发者ID:Right-Men,项目名称:Ironman,代码行数:20,代码来源:CatalystNativeJSToJavaParametersTestCase.java

示例2: getUserProperties

import com.facebook.react.bridge.ReadableMapKeySetIterator; //导入方法依赖的package包/类
private Map<String, Object> getUserProperties(ReadableMap properties) {
    ReadableMapKeySetIterator iterator = properties.keySetIterator();
    Map<String, Object> userProperties = new HashMap<>();

    while (iterator.hasNextKey()) {
        String key = iterator.nextKey();
        ReadableType type = properties.getType(key);
        if (type == ReadableType.Boolean) {
            userProperties.put(key, properties.getBoolean(key));
        } else if (type == ReadableType.Number) {
            userProperties.put(key, properties.getDouble(key));
        } else if (type == ReadableType.String) {
            userProperties.put(key, properties.getString(key));
        }
    }

    return userProperties;
}
 
开发者ID:smooch,项目名称:react-native-smooch,代码行数:19,代码来源:ReactNativeSmooch.java

示例3: parseConstraints

import com.facebook.react.bridge.ReadableMapKeySetIterator; //导入方法依赖的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: StyleAnimatedNode

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

示例5: toMap

import com.facebook.react.bridge.ReadableMapKeySetIterator; //导入方法依赖的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:davidstoneham,项目名称:react-native-mssql,代码行数:33,代码来源:MapUtil.java

示例6: createRequest

import com.facebook.react.bridge.ReadableMapKeySetIterator; //导入方法依赖的package包/类
public DownloadManager.Request createRequest(String url, ReadableMap headers, ReadableMap requestConfig) {
    String downloadTitle = requestConfig.getString("downloadTitle");
    String downloadDescription = requestConfig.getString("downloadTitle");
    String saveAsName = requestConfig.getString("saveAsName");
    Boolean allowedInRoaming = requestConfig.getBoolean("allowedInRoaming");
    Boolean allowedInMetered = requestConfig.getBoolean("allowedInMetered");
    Boolean showInDownloads = requestConfig.getBoolean("showInDownloads");

    Uri downloadUri = Uri.parse(url);
    DownloadManager.Request request = new DownloadManager.Request(downloadUri);

    ReadableMapKeySetIterator iterator = headers.keySetIterator();
    while (iterator.hasNextKey()) {
        String key = iterator.nextKey();
        request.addRequestHeader(key, headers.getString(key));
    }

    request.setTitle(downloadTitle);
    request.setDescription(downloadDescription);
    request.setDestinationInExternalFilesDir(context, Environment.DIRECTORY_DOWNLOADS, saveAsName);
    request.setAllowedOverRoaming(allowedInRoaming);
    request.setAllowedOverMetered(allowedInMetered);
    request.setVisibleInDownloadsUi(showInDownloads);
    request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_MOBILE | DownloadManager.Request.NETWORK_WIFI);
    request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
    return request;
}
 
开发者ID:master-atul,项目名称:react-native-simple-download-manager,代码行数:28,代码来源:Downloader.java

示例7: getHeaders

import com.facebook.react.bridge.ReadableMapKeySetIterator; //导入方法依赖的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

示例8: toJSONObject

import com.facebook.react.bridge.ReadableMapKeySetIterator; //导入方法依赖的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.ReadableMapKeySetIterator; //导入方法依赖的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: convertMapToJson

import com.facebook.react.bridge.ReadableMapKeySetIterator; //导入方法依赖的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

示例11: setSource

import com.facebook.react.bridge.ReadableMapKeySetIterator; //导入方法依赖的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

示例12: updateProps

import com.facebook.react.bridge.ReadableMapKeySetIterator; //导入方法依赖的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

示例13: PropsAnimatedNode

import com.facebook.react.bridge.ReadableMapKeySetIterator; //导入方法依赖的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

示例14: recursivelyDeconstructReadableMap

import com.facebook.react.bridge.ReadableMapKeySetIterator; //导入方法依赖的package包/类
public static Map<String, Object> recursivelyDeconstructReadableMap(ReadableMap readableMap) {
  Map<String, Object> deconstructedMap = new HashMap<>();
  if (readableMap == null) {
    return deconstructedMap;
  }

  ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
  while (iterator.hasNextKey()) {
    String key = iterator.nextKey();
    ReadableType type = readableMap.getType(key);
    switch (type) {
      case Null:
        deconstructedMap.put(key, null);
        break;
      case Boolean:
        deconstructedMap.put(key, readableMap.getBoolean(key));
        break;
      case Number:
        deconstructedMap.put(key, readableMap.getDouble(key));
        break;
      case String:
        deconstructedMap.put(key, readableMap.getString(key));
        break;
      case Map:
        deconstructedMap.put(key, OAuthManagerModule.recursivelyDeconstructReadableMap(readableMap.getMap(key)));
        break;
      case Array:
        deconstructedMap.put(key, OAuthManagerModule.recursivelyDeconstructReadableArray(readableMap.getArray(key)));
        break;
      default:
        throw new IllegalArgumentException("Could not convert object with key: " + key + ".");
    }

  }
  return deconstructedMap;
}
 
开发者ID:fullstackreact,项目名称:react-native-oauth,代码行数:37,代码来源:OAuthManagerModule.java

示例15: mapEqual

import com.facebook.react.bridge.ReadableMapKeySetIterator; //导入方法依赖的package包/类
private static boolean mapEqual(
    ReadableMap a,
    ReadableMap b
) {
  ReadableMapKeySetIterator iterator = b.keySetIterator();
  while (iterator.hasNextKey()) {
    String key = iterator.nextKey();
    if (!a.hasKey(key)) return false;
    ReadableType type = b.getType(key);
    if (type != a.getType(key)) return false;
    switch (type) {
      case Null:
        break;
      case Boolean:
        if (a.getBoolean(key) != b.getBoolean(key)) return false;
        break;
      case Number:
        if (a.getDouble(key) != b.getDouble(key)) return false;
        break;
      case String:
        if (!a.getString(key).equals(b.getString(key))) return false;
        break;
      case Map:
        if (!mapEqual(a.getMap(key), b.getMap(key))) return false;
        break;
      case Array:
        if (!arrayEqual(a.getArray(key), b.getArray(key))) return false;
        break;
      default:
        Log.e(TAG, "Could not convert object with key: " + key + ".");
    }
  }
  return true;
}
 
开发者ID:airbnb,项目名称:native-navigation,代码行数:35,代码来源:DefaultNavigationImplementation.java


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