当前位置: 首页>>代码示例>>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;未经允许,请勿转载。