本文整理匯總了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;
}