當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。