当前位置: 首页>>代码示例>>Java>>正文


Java TypeElement.accept方法代码示例

本文整理汇总了Java中javax.lang.model.element.TypeElement.accept方法的典型用法代码示例。如果您正苦于以下问题:Java TypeElement.accept方法的具体用法?Java TypeElement.accept怎么用?Java TypeElement.accept使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.lang.model.element.TypeElement的用法示例。


在下文中一共展示了TypeElement.accept方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validateTemplate

import javax.lang.model.element.TypeElement; //导入方法依赖的package包/类
boolean validateTemplate(final TypeElement templateElement) {
	try {
		assertThat(templateElement.getKind() == CLASS || templateElement.getKind() == ENUM,
				templateElement, ValidationMessages.ONLY_CLASS_OR_ENUM_TEMPLATE);

		assertThat(!isAnnotationPresent(templateElement, Descriptor.class), templateElement,
				ValidationMessages.NO_DESCRIPTOR_AND_TEMPLATE);

		// Repeated annotation container
		assertThat(!isAnnotationPresent(templateElement, Descriptors.class), templateElement,
				ValidationMessages.NO_DESCRIPTOR_AND_TEMPLATE);

		// Ensure that there are no template method name collisions
		templateElement.accept(TemplateMethodValidationVisitor.INSTANCE, Sets.newHashSet());

		// Ensure that static finals are initializable
		templateElement.accept(TemplateFieldValidationVisitor.INSTANCE, trees);

		return true;
	} catch (final ProcessorException pe) {
		pe.emitError(messager);
		return false;
	}
}
 
开发者ID:FermioCloud,项目名称:java-code-templates,代码行数:25,代码来源:Validator.java

示例2: process

import javax.lang.model.element.TypeElement; //导入方法依赖的package包/类
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    if (context.getRound() != 1) {
        return true;
    }
    context.incrementRound();
    WebService webService;
    WebServiceProvider webServiceProvider;
    WebServiceVisitor webServiceVisitor = new WebServiceWrapperGenerator(this, context);
    boolean processedEndpoint = false;
    Collection<TypeElement> classes = new ArrayList<TypeElement>();
    filterClasses(classes, roundEnv.getRootElements());
    for (TypeElement element : classes) {
        webServiceProvider = element.getAnnotation(WebServiceProvider.class);
        webService = element.getAnnotation(WebService.class);
        if (webServiceProvider != null) {
            if (webService != null) {
                processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_AND_WEBSERVICEPROVIDER(element.getQualifiedName()));
            }
            processedEndpoint = true;
        }

        if (webService == null) {
            continue;
        }

        element.accept(webServiceVisitor, null);
        processedEndpoint = true;
    }
    if (!processedEndpoint) {
        if (isCommandLineInvocation) {
            if (!ignoreNoWebServiceFoundWarning) {
                processWarning(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
            }
        } else {
            processError(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
        }
    }
    return true;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:WebServiceAp.java

示例3: validateDescriptor

import javax.lang.model.element.TypeElement; //导入方法依赖的package包/类
Optional<DescriptorInfo> validateDescriptor(final TypeElement descriptor, final AnnotationMirror annotation) {
	try {
		// Run DescriptorInfo validations
		final DescriptorInfo info = DescriptorInfo.create(annotation, descriptor);

		// Ensure that all types referenced in "copyTypeAnnotationsTo" are
		// either the template type itself or one of its nested types.
		final String templateClassFQ = info.templateTypeName().toString();
		info.outputAnnotationTargets().forEach(annotationTarget -> {
			assertThat(annotationTarget.getQualifiedName().toString().startsWith(templateClassFQ),
					descriptor, ValidationMessages.COPY_TYPE_ANNOTATION_TEMPLATE_AND_NESTED);
		});

		assertThat((descriptor.getKind() == CLASS && descriptor.getModifiers().contains(ABSTRACT))
				|| (descriptor.getKind() == INTERFACE),
				descriptor,
				ValidationMessages.ONLY_ABSTRACT_OR_INTERFACE_DESCRIPTOR);

		assertThat(!isAnnotationPresent(descriptor, Template.class), descriptor,
				ValidationMessages.NO_DESCRIPTOR_AND_TEMPLATE);

		descriptor.accept(DescriptorValidationVisitor.INSTANCE, descriptor);

		return Optional.of(info);
	} catch (final ProcessorException pe) {
		pe.emitError(messager);
		return Optional.empty();
	}
}
 
开发者ID:FermioCloud,项目名称:java-code-templates,代码行数:30,代码来源:Validator.java

示例4: inspectEndpointInterface

import javax.lang.model.element.TypeElement; //导入方法依赖的package包/类
private void inspectEndpointInterface(String endpointInterfaceName, TypeElement d) {
    TypeElement intTypeElement = getEndpointInterfaceElement(endpointInterfaceName, d);
    if (intTypeElement != null)
        intTypeElement.accept(this, null);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:WebServiceVisitor.java


注:本文中的javax.lang.model.element.TypeElement.accept方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。