mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
//xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/module/model:modelAndroid (#44134)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44134 Changelog: [Internal] Reviewed By: strulovich Differential Revision: D56138858 fbshipit-source-id: 5ea349b6c8565f825de273adbb192c6005a2a357
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3220825782
commit
46366867f7
@@ -2954,17 +2954,22 @@ public abstract interface annotation class com/facebook/react/module/annotations
|
||||
public abstract fun nativeModules ()[Ljava/lang/Class;
|
||||
}
|
||||
|
||||
public class com/facebook/react/module/model/ReactModuleInfo {
|
||||
public final class com/facebook/react/module/model/ReactModuleInfo {
|
||||
public static final field Companion Lcom/facebook/react/module/model/ReactModuleInfo$Companion;
|
||||
public fun <init> (Ljava/lang/String;Ljava/lang/String;ZZZZ)V
|
||||
public fun <init> (Ljava/lang/String;Ljava/lang/String;ZZZZZ)V
|
||||
public fun canOverrideExistingModule ()Z
|
||||
public static fun classIsTurboModule (Ljava/lang/Class;)Z
|
||||
public fun className ()Ljava/lang/String;
|
||||
public fun hasConstants ()Z
|
||||
public fun isCxxModule ()Z
|
||||
public fun isTurboModule ()Z
|
||||
public fun name ()Ljava/lang/String;
|
||||
public fun needsEagerInit ()Z
|
||||
public final fun canOverrideExistingModule ()Z
|
||||
public static final fun classIsTurboModule (Ljava/lang/Class;)Z
|
||||
public final fun className ()Ljava/lang/String;
|
||||
public final fun hasConstants ()Z
|
||||
public final fun isCxxModule ()Z
|
||||
public final fun isTurboModule ()Z
|
||||
public final fun name ()Ljava/lang/String;
|
||||
public final fun needsEagerInit ()Z
|
||||
}
|
||||
|
||||
public final class com/facebook/react/module/model/ReactModuleInfo$Companion {
|
||||
public final fun classIsTurboModule (Ljava/lang/Class;)Z
|
||||
}
|
||||
|
||||
public abstract interface class com/facebook/react/module/model/ReactModuleInfoProvider {
|
||||
|
||||
-95
@@ -1,95 +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.module.model;
|
||||
|
||||
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
||||
|
||||
/**
|
||||
* Data holder class holding native module specifications. {@link ReactModuleSpecProcessor} creates
|
||||
* these so Java modules don't have to be instantiated at React Native start up.
|
||||
*/
|
||||
public class ReactModuleInfo {
|
||||
|
||||
private final String mName;
|
||||
private final boolean mCanOverrideExistingModule;
|
||||
private final boolean mNeedsEagerInit;
|
||||
private final boolean mIsCxxModule;
|
||||
private final String mClassName;
|
||||
private final boolean mIsTurboModule;
|
||||
|
||||
public ReactModuleInfo(
|
||||
String name,
|
||||
String className,
|
||||
boolean canOverrideExistingModule,
|
||||
boolean needsEagerInit,
|
||||
boolean isCxxModule,
|
||||
boolean isTurboModule) {
|
||||
mName = name;
|
||||
mClassName = className;
|
||||
mCanOverrideExistingModule = canOverrideExistingModule;
|
||||
mNeedsEagerInit = needsEagerInit;
|
||||
mIsCxxModule = isCxxModule;
|
||||
mIsTurboModule = isTurboModule;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link ReactModuleInfo#ReactModuleInfo(String, String, boolean, boolean,
|
||||
* boolean, boolean)}
|
||||
*/
|
||||
@Deprecated
|
||||
public ReactModuleInfo(
|
||||
String name,
|
||||
String className,
|
||||
boolean canOverrideExistingModule,
|
||||
boolean needsEagerInit,
|
||||
boolean hasConstants,
|
||||
boolean isCxxModule,
|
||||
boolean isTurboModule) {
|
||||
this(name, className, canOverrideExistingModule, needsEagerInit, isCxxModule, isTurboModule);
|
||||
}
|
||||
|
||||
public String name() {
|
||||
return mName;
|
||||
}
|
||||
|
||||
public String className() {
|
||||
return mClassName;
|
||||
}
|
||||
|
||||
public boolean canOverrideExistingModule() {
|
||||
return mCanOverrideExistingModule;
|
||||
}
|
||||
|
||||
public boolean needsEagerInit() {
|
||||
return mNeedsEagerInit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated this is hardcoded to return true, regardless if the module has constants or not
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean hasConstants() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isCxxModule() {
|
||||
return mIsCxxModule;
|
||||
}
|
||||
|
||||
public boolean isTurboModule() {
|
||||
return mIsTurboModule;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the passed class is a TurboModule. Useful to populate the parameter [isTurboModule]
|
||||
* in the constructor of ReactModuleInfo.
|
||||
*/
|
||||
public static boolean classIsTurboModule(Class<?> clazz) {
|
||||
return TurboModule.class.isAssignableFrom(clazz);
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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.module.model
|
||||
|
||||
import com.facebook.react.turbomodule.core.interfaces.TurboModule
|
||||
|
||||
/**
|
||||
* Data holder class holding native module specifications. [ReactModuleSpecProcessor] creates these
|
||||
* so Java modules don't have to be instantiated at React Native start up.
|
||||
*/
|
||||
public class ReactModuleInfo(
|
||||
private val _name: String,
|
||||
private val _className: String,
|
||||
private val _canOverrideExistingModule: Boolean,
|
||||
private val _needsEagerInit: Boolean,
|
||||
public val isCxxModule: Boolean,
|
||||
public val isTurboModule: Boolean
|
||||
) {
|
||||
|
||||
@Deprecated("use ReactModuleInfo(String, String, boolean, boolean, boolean, boolean)]")
|
||||
public constructor(
|
||||
name: String,
|
||||
className: String,
|
||||
canOverrideExistingModule: Boolean,
|
||||
needsEagerInit: Boolean,
|
||||
@Suppress("UNUSED_PARAMETER") hasConstants: Boolean,
|
||||
isCxxModule: Boolean,
|
||||
isTurboModule: Boolean
|
||||
) : this(name, className, canOverrideExistingModule, needsEagerInit, isCxxModule, isTurboModule)
|
||||
|
||||
public fun name(): String = _name
|
||||
|
||||
public fun className(): String = _className
|
||||
|
||||
public fun canOverrideExistingModule(): Boolean = _canOverrideExistingModule
|
||||
|
||||
public fun needsEagerInit(): Boolean = _needsEagerInit
|
||||
|
||||
@Deprecated("this is hardcoded to return true, regardless if the module has constants or not")
|
||||
public fun hasConstants(): Boolean = true
|
||||
|
||||
public companion object {
|
||||
/**
|
||||
* Checks if the passed class is a TurboModule. Useful to populate the parameter [isTurboModule]
|
||||
* in the constructor of ReactModuleInfo.
|
||||
*/
|
||||
@JvmStatic
|
||||
public fun classIsTurboModule(clazz: Class<*>): Boolean =
|
||||
TurboModule::class.java.isAssignableFrom(clazz)
|
||||
}
|
||||
}
|
||||
+3
-6
@@ -5,12 +5,9 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.module.model;
|
||||
|
||||
import java.util.Map;
|
||||
package com.facebook.react.module.model
|
||||
|
||||
/** Interface for auto-generated class by ReactModuleSpecProcessor. */
|
||||
public interface ReactModuleInfoProvider {
|
||||
|
||||
Map<String, ReactModuleInfo> getReactModuleInfos();
|
||||
public fun interface ReactModuleInfoProvider {
|
||||
public fun getReactModuleInfos(): Map<String, ReactModuleInfo>
|
||||
}
|
||||
Reference in New Issue
Block a user