Kotlinify WritableMap (#43894)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43894

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: javache, cortinico

Differential Revision: D55793215

fbshipit-source-id: bec6ca309683831f4c976cc49c91698fb6dd6552
This commit is contained in:
Fabrizio Cucci
2024-04-06 06:29:15 -07:00
committed by Facebook GitHub Bot
parent 35d5754b36
commit aae9fa24fa
2 changed files with 31 additions and 35 deletions
@@ -1,35 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.bridge;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
/** Interface for a mutable map. Used to pass arguments from Java to JS. */
public interface WritableMap extends ReadableMap {
void putNull(@NonNull String key);
void putBoolean(@NonNull String key, boolean value);
void putDouble(@NonNull String key, double value);
void putInt(@NonNull String key, int value);
void putLong(@NonNull String key, long value);
void putString(@NonNull String key, @Nullable String value);
void putArray(@NonNull String key, @Nullable ReadableArray value);
void putMap(@NonNull String key, @Nullable ReadableMap value);
void merge(@NonNull ReadableMap source);
WritableMap copy();
}
@@ -0,0 +1,31 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.bridge
/** Interface for a mutable map. Used to pass arguments from Kotlin to JS. */
public interface WritableMap : ReadableMap {
public fun copy(): WritableMap
public fun merge(source: ReadableMap)
public fun putArray(key: String, value: ReadableArray?)
public fun putBoolean(key: String, value: Boolean)
public fun putDouble(key: String, value: Double)
public fun putInt(key: String, value: Int)
public fun putLong(key: String, value: Long)
public fun putMap(key: String, value: ReadableMap?)
public fun putNull(key: String)
public fun putString(key: String, value: String?)
}