mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Format Java code in xplat/js/react-native-github
Summary: This diff formats the Java class files inside xplat/js/react-native-github. Since google-java-format was enabled in D16071401 we want to codemode the existing code so that users don't have to deal with formatter lint noise at diff-time. ```arc f --paths-cmd 'hg files -I "**/*.java"'``` drop-conflicts Reviewed By: cpojer Differential Revision: D16071725 fbshipit-source-id: fc6e3852e45742c109f0c5ac4065d64201c74204
This commit is contained in:
committed by
Facebook Github Bot
parent
61e95e5cbf
commit
6c0f73b322
@@ -1,49 +1,44 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* <p>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 javax.annotation.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Base class for Catalyst native modules whose implementations are written in Java. Default
|
||||
* implementations for {@link #initialize} and {@link #onCatalystInstanceDestroy} are provided for
|
||||
* convenience. Subclasses which override these don't need to call {@code super} in case of
|
||||
* convenience. Subclasses which override these don't need to call {@code super} in case of
|
||||
* overriding those methods as implementation of those methods is empty.
|
||||
*
|
||||
* BaseJavaModules can be linked to Fragments' lifecycle events, {@link CatalystInstance} creation
|
||||
* and destruction, by being called on the appropriate method when a life cycle event occurs.
|
||||
* <p>BaseJavaModules can be linked to Fragments' lifecycle events, {@link CatalystInstance}
|
||||
* creation and destruction, by being called on the appropriate method when a life cycle event
|
||||
* occurs.
|
||||
*
|
||||
* Native methods can be exposed to JS with {@link ReactMethod} annotation. Those methods may
|
||||
* only use limited number of types for their arguments:
|
||||
* 1/ primitives (boolean, int, float, double
|
||||
* 2/ {@link String} mapped from JS string
|
||||
* 3/ {@link ReadableArray} mapped from JS Array
|
||||
* 4/ {@link ReadableMap} mapped from JS Object
|
||||
* 5/ {@link Callback} mapped from js function and can be used only as a last parameter or in the
|
||||
* case when it express success & error callback pair as two last arguments respectively.
|
||||
* <p>Native methods can be exposed to JS with {@link ReactMethod} annotation. Those methods may
|
||||
* only use limited number of types for their arguments: 1/ primitives (boolean, int, float, double
|
||||
* 2/ {@link String} mapped from JS string 3/ {@link ReadableArray} mapped from JS Array 4/ {@link
|
||||
* ReadableMap} mapped from JS Object 5/ {@link Callback} mapped from js function and can be used
|
||||
* only as a last parameter or in the case when it express success & error callback pair as two last
|
||||
* arguments respectively.
|
||||
*
|
||||
* All methods exposed as native to JS with {@link ReactMethod} annotation must return
|
||||
* {@code void}.
|
||||
* <p>All methods exposed as native to JS with {@link ReactMethod} annotation must return {@code
|
||||
* void}.
|
||||
*
|
||||
* Please note that it is not allowed to have multiple methods annotated with {@link ReactMethod}
|
||||
* <p>Please note that it is not allowed to have multiple methods annotated with {@link ReactMethod}
|
||||
* with the same name.
|
||||
*/
|
||||
public abstract class BaseJavaModule implements NativeModule {
|
||||
// taken from Libraries/Utilities/MessageQueue.js
|
||||
static final public String METHOD_TYPE_ASYNC = "async";
|
||||
static final public String METHOD_TYPE_PROMISE= "promise";
|
||||
static final public String METHOD_TYPE_SYNC = "sync";
|
||||
public static final String METHOD_TYPE_ASYNC = "async";
|
||||
public static final String METHOD_TYPE_PROMISE = "promise";
|
||||
public static final String METHOD_TYPE_SYNC = "sync";
|
||||
|
||||
/**
|
||||
* @return a map of constants this module exports to JS. Supports JSON types.
|
||||
*/
|
||||
/** @return a map of constants this module exports to JS. Supports JSON types. */
|
||||
public @Nullable Map<String, Object> getConstants() {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user