Permalink
Browse files

Introduce getConstants generation for Native Modules codegen.

Reviewed By: fkgozali

Differential Revision: D6125394

fbshipit-source-id: 13b48c75056868f45394f277d75fb05d167f1c9f
  • Loading branch information...
Dmitry Zakharov authored and facebook-github-bot committed Oct 30, 2017
1 parent 9742bcb commit a5550a56ea2f9647e47e2d7489d6efbefda3518a
@@ -170,8 +170,13 @@ private CodeBlock getCodeBlockForReactModuleInfos(List<String> nativeModules)
List<? extends Element> elements = typeElement.getEnclosedElements();
boolean hasConstants = false;
if (elements != null) {
hasConstants = elements.stream()
.anyMatch((Element m) -> m.getKind() == ElementKind.METHOD && m.getSimpleName().contentEquals("getConstants"));
hasConstants =
elements
.stream()
.filter(element -> element.getKind() == ElementKind.METHOD)
.map(Element::getSimpleName)
.anyMatch(
name -> name.contentEquals("getConstants") || name.contentEquals("getTypedExportedConstants"));
}
String valueString = new StringBuilder()

0 comments on commit a5550a5

Please sign in to comment.