本文整理汇总了Java中javax.annotation.processing.RoundEnvironment.getRootElements方法的典型用法代码示例。如果您正苦于以下问题:Java RoundEnvironment.getRootElements方法的具体用法?Java RoundEnvironment.getRootElements怎么用?Java RoundEnvironment.getRootElements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.annotation.processing.RoundEnvironment
的用法示例。
在下文中一共展示了RoundEnvironment.getRootElements方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import javax.annotation.processing.RoundEnvironment; //导入方法依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
for (Element e: roundEnv.getRootElements()) {
Element m = e.getEnclosingElement();
while (!(m instanceof ModuleElement)) {
m = m.getEnclosingElement();
}
Set<String> found = m.getEnclosedElements().stream()
.map(p -> ((PackageElement)p).isUnnamed() ?
"unnamed package" :
((PackageElement)p).getQualifiedName().toString())
.collect(Collectors.toSet());
if (!Objects.equals(expected, found)) {
System.err.println("expected: " + expected);
System.err.println("found: " + found);
throw new AssertionError("unexpected packages found");
}
}
return false;
}
示例2: process
import javax.annotation.processing.RoundEnvironment; //导入方法依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
for (Element element : roundEnv.getRootElements()) {
if (element.getSimpleName().toString().equals("InjectPresenterTypeBehaviorView")) {
for (Element element1 : element.getEnclosedElements()) {
System.out.println("EnclosedElements: " + element1.getSimpleName());
ImmutableList<String> of = ImmutableList.of("mPresenterIdLocalPresenter", "mTagLocalPresenter", "mFactoryLocalPresenter", "mFactoryTagPresenter");
if (of.contains(element1.getSimpleName().toString())) {
messager.printMessage(Diagnostic.Kind.ERROR, "expected error!", element1);
}
}
}
}
return true;
}
示例3: process
import javax.annotation.processing.RoundEnvironment; //导入方法依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> tes,
RoundEnvironment renv) {
for(Element element : renv.getRootElements()) {
print(element);
}
// Just print the elements, nothing more to do.
return true;
}
示例4: process
import javax.annotation.processing.RoundEnvironment; //导入方法依赖的package包/类
@Override
public boolean process(final Set<? extends TypeElement> annotations,
final RoundEnvironment roundEnv) {
for (final Element rootElement : roundEnv.getRootElements()) {
try {
processClass(rootElement);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return false;
}
示例5: process
import javax.annotation.processing.RoundEnvironment; //导入方法依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
for (Element e: roundEnv.getRootElements()) {
Element m = e.getEnclosingElement();
while (!(m instanceof ModuleElement)) {
m = m.getEnclosingElement();
}
((ModuleSymbol)m).getDirectives();
RequiresDirective requiresDirective = ((ModuleSymbol)m).requires.head;
Assert.check(requiresDirective.getDependency().getQualifiedName().toString().equals("java.base"));
Assert.check(requiresDirective.flags.contains(MANDATED));
}
return false;
}
示例6: process
import javax.annotation.processing.RoundEnvironment; //导入方法依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
TestElementScanner s = new TestElementScanner();
for (Element e: roundEnv.getRootElements()) {
s.scan(e, null);
}
return true;
}
示例7: process
import javax.annotation.processing.RoundEnvironment; //导入方法依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnv) {
Messager messager = processingEnv.getMessager();
for (Element e : roundEnv.getRootElements()) {
messager.printMessage(WARNING, WRN_NO_SOURCE);
messager.printMessage(WARNING, WRN_WITH_SOURCE, e);
messager.printMessage(WARNING, WRN_NO_SOURCE);
}
return false;
}
示例8: process
import javax.annotation.processing.RoundEnvironment; //导入方法依赖的package包/类
public boolean process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnvironment) {
if (!roundEnvironment.processingOver())
for(Element element : roundEnvironment.getRootElements())
element.accept(new LocalVarAllergy(), null);
return true;
}
示例9: process
import javax.annotation.processing.RoundEnvironment; //导入方法依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
for (Element e : roundEnv.getRootElements()) {
checker.scan(checker.trees.getPath(e), null);
}
return true;
}
示例10: process
import javax.annotation.processing.RoundEnvironment; //导入方法依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
Trees trees = Trees.instance(processingEnv);
if (round++ == 0) {
for (Element e: roundEnv.getRootElements()) {
TreePath p = trees.getPath(e);
new Scanner().scan(p, trees);
}
}
return false;
}
示例11: process
import javax.annotation.processing.RoundEnvironment; //导入方法依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
for (Element e: roundEnv.getRootElements()) {
new DocCommentScanner(trees.getPath(e)).scan();
}
return true;
}