當前位置: 首頁>>代碼示例>>Java>>正文


Java RoundEnvironment.getRootElements方法代碼示例

本文整理匯總了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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:21,代碼來源:UnnamedModuleUnnamedPackageTest.java

示例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;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:16,代碼來源:ErrorProcessor.java

示例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;
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:12,代碼來源:PrintingProcessor.java

示例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;
}
 
開發者ID:PacktPublishing,項目名稱:Java-9-Programming-By-Example,代碼行數:13,代碼來源:Processor.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:15,代碼來源:NPEGetDirectivesTest.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:9,代碼來源:BasicAnnoTests.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:12,代碼來源:MessagerDiags.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:8,代碼來源:T6350057.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:8,代碼來源:Test.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:12,代碼來源:TestGetScope.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:8,代碼來源:ReferenceTest.java


注:本文中的javax.annotation.processing.RoundEnvironment.getRootElements方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。