mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-03 07:14:59 +08:00
Change class names to modules names in packages
Reviewed By: achen1 Differential Revision: D9508095 fbshipit-source-id: e3973ea417c803110eb8612c854a6374a849474b
This commit is contained in:
committed by
Facebook Github Bot
parent
5eaa2d29c0
commit
48169b28e2
@@ -16,14 +16,17 @@ public class ReactModuleInfo {
|
||||
private final boolean mNeedsEagerInit;
|
||||
private final boolean mHasConstants;
|
||||
private final boolean mIsCxxModule;
|
||||
private String mClassName;
|
||||
|
||||
public ReactModuleInfo(
|
||||
String name,
|
||||
String className,
|
||||
boolean canOverrideExistingModule,
|
||||
boolean needsEagerInit,
|
||||
boolean hasConstants,
|
||||
boolean isCxxModule) {
|
||||
mName = name;
|
||||
mClassName = className;
|
||||
mCanOverrideExistingModule = canOverrideExistingModule;
|
||||
mNeedsEagerInit = needsEagerInit;
|
||||
mHasConstants = hasConstants;
|
||||
@@ -34,6 +37,8 @@ public class ReactModuleInfo {
|
||||
return mName;
|
||||
}
|
||||
|
||||
public String className() {return mClassName;}
|
||||
|
||||
public boolean canOverrideExistingModule() {
|
||||
return mCanOverrideExistingModule;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ import javax.annotation.processing.RoundEnvironment;
|
||||
import javax.annotation.processing.SupportedAnnotationTypes;
|
||||
import javax.annotation.processing.SupportedSourceVersion;
|
||||
import javax.lang.model.SourceVersion;
|
||||
import javax.lang.model.element.AnnotationMirror;
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.ElementKind;
|
||||
import javax.lang.model.element.Modifier;
|
||||
@@ -45,31 +44,6 @@ import javax.lang.model.type.TypeMirror;
|
||||
import javax.lang.model.util.Elements;
|
||||
import javax.lang.model.util.Types;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.facebook.infer.annotation.SuppressFieldNotInitialized;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
import com.facebook.react.module.annotations.ReactModuleList;
|
||||
import com.facebook.react.module.model.ReactModuleInfo;
|
||||
import com.facebook.react.module.model.ReactModuleInfoProvider;
|
||||
|
||||
import com.squareup.javapoet.ClassName;
|
||||
import com.squareup.javapoet.CodeBlock;
|
||||
import com.squareup.javapoet.JavaFile;
|
||||
import com.squareup.javapoet.MethodSpec;
|
||||
import com.squareup.javapoet.ParameterizedTypeName;
|
||||
import com.squareup.javapoet.TypeName;
|
||||
import com.squareup.javapoet.TypeSpec;
|
||||
|
||||
import static javax.lang.model.element.Modifier.PUBLIC;
|
||||
import static javax.tools.Diagnostic.Kind.ERROR;
|
||||
|
||||
/**
|
||||
* Generates a list of ReactModuleInfo for modules annotated with {@link ReactModule} in
|
||||
@@ -211,14 +185,15 @@ public class ReactModuleSpecProcessor extends AbstractProcessor {
|
||||
String valueString = new StringBuilder()
|
||||
.append("new ReactModuleInfo(")
|
||||
.append("\"").append(reactModule.name()).append("\"").append(", ")
|
||||
.append(reactModule.canOverrideExistingModule()).append(", ")
|
||||
.append("\"").append(keyString).append("\"").append(", ")
|
||||
.append(reactModule.canOverrideExistingModule()).append(", ")
|
||||
.append(reactModule.needsEagerInit()).append(", ")
|
||||
.append(hasConstants).append(", ")
|
||||
.append(reactModule.isCxxModule())
|
||||
.append(")")
|
||||
.toString();
|
||||
|
||||
builder.addStatement("map.put(\"" + keyString + "\", " + valueString + ")");
|
||||
builder.addStatement("map.put(\"" + reactModule.name() + "\", " + valueString + ")");
|
||||
}
|
||||
builder.addStatement("return map");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user