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


Java WritableArray.pushDouble方法代码示例

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


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

示例1: jsonToReact

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
public static WritableArray jsonToReact(JSONArray jsonArray) throws JSONException {
    WritableArray writableArray = Arguments.createArray();
    for(int i=0; i < jsonArray.length(); i++) {
        Object value = jsonArray.get(i);
        if (value instanceof Float || value instanceof Double) {
            writableArray.pushDouble(jsonArray.getDouble(i));
        } else if (value instanceof Number) {
            writableArray.pushInt(jsonArray.getInt(i));
        } else if (value instanceof String) {
            writableArray.pushString(jsonArray.getString(i));
        } else if (value instanceof JSONObject) {
            writableArray.pushMap(jsonToReact(jsonArray.getJSONObject(i)));
        } else if (value instanceof JSONArray){
            writableArray.pushArray(jsonToReact(jsonArray.getJSONArray(i)));
        } else if (value == JSONObject.NULL){
            writableArray.pushNull();
        }
    }
    return writableArray;
}
 
开发者ID:whitedogg13,项目名称:react-native-nfc-manager,代码行数:21,代码来源:JsonConvert.java

示例2: pushObject

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
public static void pushObject(WritableArray a, Object v) {
  if (v == null) {
    a.pushNull();
  } else if (v instanceof String) {
    a.pushString((String) v);
  } else if (v instanceof Bundle) {
    a.pushMap(fromBundle((Bundle) v));
  } else if (v instanceof Byte) {
    a.pushInt(((Byte) v) & 0xff);
  } else if (v instanceof Integer) {
    a.pushInt((Integer) v);
  } else if (v instanceof Float) {
    a.pushDouble((Float) v);
  } else if (v instanceof Double) {
    a.pushDouble((Double) v);
  } else if (v instanceof Boolean) {
    a.pushBoolean((Boolean) v);
  } else {
    throw new IllegalArgumentException("Unknown type " + v.getClass());
  }
}
 
开发者ID:de-code,项目名称:react-native-android-speech-recognizer,代码行数:22,代码来源:ArgumentsConverter.java

示例3: toWritableArray

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
public static WritableArray toWritableArray(Object[] array) {
  WritableArray writableArray = Arguments.createArray();

  for (int i = 0; i < array.length; i++) {
    Object value = array[i];

    if (value == null) {
      writableArray.pushNull();
    }
    if (value instanceof Boolean) {
      writableArray.pushBoolean((Boolean) value);
    }
    if (value instanceof Double) {
      writableArray.pushDouble((Double) value);
    }
    if (value instanceof Integer) {
      writableArray.pushInt((Integer) value);
    }
    if (value instanceof String) {
      writableArray.pushString((String) value);
    }
    if (value instanceof Map) {
      writableArray.pushMap(MapUtil.toWritableMap((Map<String, Object>) value));
    }
    if (value.getClass().isArray()) {
      writableArray.pushArray(ArrayUtil.toWritableArray((Object[]) value));
    }
  }

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

示例4: doubleArrayToReadableArray

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
public static ReadableArray doubleArrayToReadableArray(double[] arr) {
    WritableArray writableArray = new WritableNativeArray();
    for (double d : arr) {
        writableArray.pushDouble(d);
    }

    return writableArray;
}
 
开发者ID:reneweb,项目名称:react-native-tensorflow,代码行数:9,代码来源:ArrayConverter.java

示例5: floatArrayToReadableArray

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
public static ReadableArray floatArrayToReadableArray(float[] arr) {
    WritableArray writableArray = new WritableNativeArray();
    for (float f : arr) {
        writableArray.pushDouble(f);
    }

    return writableArray;
}
 
开发者ID:reneweb,项目名称:react-native-tensorflow,代码行数:9,代码来源:ArrayConverter.java

示例6: jsonArrayToWritableArray

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
public static WritableArray jsonArrayToWritableArray(JSONArray jsonArray) {
    WritableArray writableArray = new WritableNativeArray();

    try {
        if (jsonArray == null) {
            return null;
        }

        if (jsonArray.length() <= 0) {
            return null;
        }

        for (int i = 0 ; i < jsonArray.length(); i++) {
            Object value = jsonArray.get(i);
            if (value == null) {
                writableArray.pushNull();
            } else if (value instanceof Boolean) {
                writableArray.pushBoolean((Boolean) value);
            } else if (value instanceof Integer) {
                writableArray.pushInt((Integer) value);
            } else if (value instanceof Double) {
                writableArray.pushDouble((Double) value);
            } else if (value instanceof String) {
                writableArray.pushString((String) value);
            } else if (value instanceof JSONObject) {
                writableArray.pushMap(jsonToWritableMap((JSONObject) value));
            } else if (value instanceof JSONArray) {
                writableArray.pushArray(jsonArrayToWritableArray((JSONArray) value));
            }
        }
    } catch (JSONException e) {
        // Do nothing and fail silently
    }

    return writableArray;
}
 
开发者ID:ccm-innovation,项目名称:react-native-twilio-chat,代码行数:37,代码来源:RCTConvert.java

示例7: toWritableArray

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
public static WritableArray toWritableArray(Object[] array) {
    WritableArray writableArray = Arguments.createArray();

    for (int i = 0; i < array.length; i++) {
        Object value = array[i];

        if (value == null) {
            writableArray.pushNull();
        }
        if (value instanceof Boolean) {
            writableArray.pushBoolean((Boolean) value);
        }
        if (value instanceof Double) {
            writableArray.pushDouble((Double) value);
        }
        if (value instanceof Integer) {
            writableArray.pushInt((Integer) value);
        }
        if (value instanceof String) {
            writableArray.pushString((String) value);
        }
        if (value instanceof Map) {
            writableArray.pushMap(MapUtil.toWritableMap((Map<String, Object>) value));
        }
        if (value.getClass().isArray()) {
            writableArray.pushArray(ArrayUtil.toWritableArray((Object[]) value));
        }
    }

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

示例8: convertJsonToArray

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
public static WritableArray convertJsonToArray(JSONArray jsonArray) throws JSONException {
    WritableArray array = new WritableNativeArray();

    for (int i = 0; i < jsonArray.length(); i++) {
        Object value = jsonArray.get(i);
        if (value instanceof JSONObject) {
            array.pushMap(convertJsonToMap((JSONObject) value));
        } else if (value instanceof  JSONArray) {
            array.pushArray(convertJsonToArray((JSONArray) value));
        } else if (value instanceof  Boolean) {
            array.pushBoolean((Boolean) value);
        } else if (value instanceof  Integer) {
            array.pushInt((Integer) value);
        } else if (value instanceof  Double) {
            array.pushDouble((Double) value);
        } else if (value instanceof String)  {
            array.pushString((String) value);
        } else {
            array.pushString(value.toString());
        }
    }
    return array;
}
 
开发者ID:salathegroup,项目名称:react-native-scandit,代码行数:24,代码来源:ReactBridgeHelpers.java

示例9: convertJsonToArray

import com.facebook.react.bridge.WritableArray; //导入方法依赖的package包/类
private static WritableArray convertJsonToArray(JSONArray jsonArray) throws JSONException {
  WritableArray array = new WritableNativeArray();

  for (int i = 0; i < jsonArray.length(); i++) {
    Object value = jsonArray.get(i);
    if (value instanceof JSONObject) {
      array.pushMap(convertJsonToMap((JSONObject) value));
    } else if (value instanceof JSONArray) {
      array.pushArray(convertJsonToArray((JSONArray) value));
    } else if (value instanceof Boolean) {
      array.pushBoolean((Boolean) value);
    } else if (value instanceof Integer) {
      array.pushInt((Integer) value);
    } else if (value instanceof Double) {
      array.pushDouble((Double) value);
    } else if (value instanceof String) {
      array.pushString((String) value);
    } else {
      array.pushString(value.toString());
    }
  }
  return array;
}
 
开发者ID:humaniq,项目名称:react-native-android-library-humaniq-api,代码行数:24,代码来源:ModelConverterUtils.java


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