Introduce getConstants generation for Native Modules codegen.

Reviewed By: fkgozali

Differential Revision: D6125394

fbshipit-source-id: 13b48c75056868f45394f277d75fb05d167f1c9f
This commit is contained in:
Dmitry Zakharov 2017-10-30 08:10:13 -07:00 committed by Facebook Github Bot
parent 9742bcb4ba
commit a5550a56ea
1 changed files with 7 additions and 2 deletions

View File

@ -170,8 +170,13 @@ public class ReactModuleSpecProcessor extends AbstractProcessor {
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()