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


Java TypeResolver.typeRefToFullyQualifiedName方法代码示例

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


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

示例1: handleAnnotation

import lombok.core.TypeResolver; //导入方法依赖的package包/类
/**
 * Handles the provided annotation node by first finding a qualifying instance of
 * {@link EclipseAnnotationHandler} and if one exists, calling it with a freshly cooked up
 * instance of {@link AnnotationValues}.
 * 
 * Note that depending on the printASTOnly flag, the {@link lombok.core.PrintAST} annotation
 * will either be silently skipped, or everything that isn't {@code PrintAST} will be skipped.
 * 
 * The HandlerLibrary will attempt to guess if the given annotation node represents a lombok annotation.
 * For example, if {@code lombok.*} is in the import list, then this method will guess that
 * {@code Getter} refers to {@code lombok.Getter}, presuming that {@link lombok.eclipse.handlers.HandleGetter}
 * has been loaded.
 * 
 * @param ast The Compilation Unit that contains the Annotation AST Node.
 * @param annotationNode The Lombok AST Node representing the Annotation AST Node.
 * @param annotation 'node.get()' - convenience parameter.
 */
public void handleAnnotation(CompilationUnitDeclaration ast, EclipseNode annotationNode, org.eclipse.jdt.internal.compiler.ast.Annotation annotation, long priority) {
	TypeResolver resolver = new TypeResolver(annotationNode.getImportList());
	TypeReference rawType = annotation.type;
	if (rawType == null) return;
	
	String fqn = resolver.typeRefToFullyQualifiedName(annotationNode, typeLibrary, toQualifiedName(annotation.type.getTypeName()));
	if (fqn == null) return;
	AnnotationHandlerContainer<?> container = annotationHandlers.get(fqn);
	if (container == null) return;
	if (priority != container.getPriority()) return;
	
	if (!annotationNode.isCompleteParse() && container.deferUntilPostDiet()) {
		if (needsHandling(annotation)) container.preHandle(annotation, annotationNode);
		return;
	}
	
	try {
		if (checkAndSetHandled(annotation)) container.handle(annotation, annotationNode);
	} catch (AnnotationValueDecodeFail fail) {
		fail.owner.setError(fail.getMessage(), fail.idx);
	} catch (Throwable t) {
		error(ast, String.format("Lombok annotation handler %s failed", container.handler.getClass()), t);
	}
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:42,代码来源:HandlerLibrary.java

示例2: handleAnnotation

import lombok.core.TypeResolver; //导入方法依赖的package包/类
/**
 * Handles the provided annotation node by first finding a qualifying instance of
 * {@link JavacAnnotationHandler} and if one exists, calling it with a freshly cooked up
 * instance of {@link lombok.core.AnnotationValues}.
 * 
 * Note that depending on the printASTOnly flag, the {@link lombok.core.PrintAST} annotation
 * will either be silently skipped, or everything that isn't {@code PrintAST} will be skipped.
 * 
 * The HandlerLibrary will attempt to guess if the given annotation node represents a lombok annotation.
 * For example, if {@code lombok.*} is in the import list, then this method will guess that
 * {@code Getter} refers to {@code lombok.Getter}, presuming that {@link lombok.javac.handlers.HandleGetter}
 * has been loaded.
 * 
 * @param unit The Compilation Unit that contains the Annotation AST Node.
 * @param node The Lombok AST Node representing the Annotation AST Node.
 * @param annotation 'node.get()' - convenience parameter.
 */
public void handleAnnotation(JCCompilationUnit unit, JavacNode node, JCAnnotation annotation, long priority) {
	TypeResolver resolver = new TypeResolver(node.getImportList());
	String rawType = annotation.annotationType.toString();
	String fqn = resolver.typeRefToFullyQualifiedName(node, typeLibrary, rawType);
	if (fqn == null) return;
	AnnotationHandlerContainer<?> container = annotationHandlers.get(fqn);
	if (container == null) return;
	
	try {
		if (container.getPriority() == priority) {
			if (checkAndSetHandled(annotation)) container.handle(node);
		}
	} catch (AnnotationValueDecodeFail fail) {
		fail.owner.setError(fail.getMessage(), fail.idx);
	} catch (Throwable t) {
		String sourceName = "(unknown).java";
		if (unit != null && unit.sourcefile != null) sourceName = unit.sourcefile.getName();
		javacError(String.format("Lombok annotation handler %s failed on " + sourceName, container.handler.getClass()), t);
	}
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:38,代码来源:HandlerLibrary.java

示例3: handleAnnotation

import lombok.core.TypeResolver; //导入方法依赖的package包/类
/**
 * Handles the provided annotation node by first finding a qualifying instance of
 * {@link EclipseAnnotationHandler} and if one exists, calling it with a freshly cooked up
 * instance of {@link AnnotationValues}.
 * 
 * Note that depending on the printASTOnly flag, the {@link lombok.core.PrintAST} annotation
 * will either be silently skipped, or everything that isn't {@code PrintAST} will be skipped.
 * 
 * The HandlerLibrary will attempt to guess if the given annotation node represents a lombok annotation.
 * For example, if {@code lombok.*} is in the import list, then this method will guess that
 * {@code Getter} refers to {@code lombok.Getter}, presuming that {@link lombok.eclipse.handlers.HandleGetter}
 * has been loaded.
 * 
 * @param ast The Compilation Unit that contains the Annotation AST Node.
 * @param annotationNode The Lombok AST Node representing the Annotation AST Node.
 * @param annotation 'node.get()' - convenience parameter.
 */
public void handleAnnotation(CompilationUnitDeclaration ast, EclipseNode annotationNode, org.eclipse.jdt.internal.compiler.ast.Annotation annotation, long priority) {
	TypeResolver resolver = new TypeResolver(annotationNode.getImportList());
	TypeReference rawType = annotation.type;
	if (rawType == null) return;
	
	String fqn = resolver.typeRefToFullyQualifiedName(annotationNode, typeLibrary, toQualifiedName(annotation.type.getTypeName()));
	if (fqn == null) return;
	AnnotationHandlerContainer<?> container = annotationHandlers.get(fqn);
	if (container == null) return;
	if (priority != container.getPriority()) return;
	if (container.deferUntilBuildFieldsAndMethods()) return;
	
	if (!annotationNode.isCompleteParse() && container.deferUntilPostDiet()) {
		if (needsHandling(annotation)) container.preHandle(annotation, annotationNode);
		return;
	}
	
	try {
		if (checkAndSetHandled(annotation)) container.handle(annotation, annotationNode);
	} catch (AnnotationValueDecodeFail fail) {
		fail.owner.setError(fail.getMessage(), fail.idx);
	} catch (Throwable t) {
		error(ast, String.format("Lombok annotation handler %s failed", container.handler.getClass()), t);
	}
}
 
开发者ID:redundent,项目名称:lombok,代码行数:43,代码来源:HandlerLibrary.java


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