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


Java SpiLoadUtil类代码示例

本文整理汇总了Java中lombok.core.SpiLoadUtil的典型用法代码示例。如果您正苦于以下问题:Java SpiLoadUtil类的具体用法?Java SpiLoadUtil怎么用?Java SpiLoadUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: loadAnnotationHandlers

import lombok.core.SpiLoadUtil; //导入依赖的package包/类
/** Uses SPI Discovery to find implementations of {@link EclipseAnnotationHandler}. */
@SuppressWarnings({"rawtypes", "unchecked"})
private static void loadAnnotationHandlers(HandlerLibrary lib) {
	try {
		for (EclipseAnnotationHandler<?> handler : SpiLoadUtil.findServices(EclipseAnnotationHandler.class, EclipseAnnotationHandler.class.getClassLoader())) {
			try {
				Class<? extends Annotation> annotationClass = handler.getAnnotationHandledByThisHandler();
				AnnotationHandlerContainer<?> container = new AnnotationHandlerContainer(handler, annotationClass);
				String annotationClassName = container.annotationClass.getName().replace("$", ".");
				if (lib.annotationHandlers.put(annotationClassName, container) != null) {
					error(null, "Duplicate handlers for annotation type: " + annotationClassName, null);
				}
				lib.typeLibrary.addType(container.annotationClass.getName());
			} catch (Throwable t) {
				error(null, "Can't load Lombok annotation handler for Eclipse: ", t);
			}
		}
	} catch (IOException e) {
		throw Lombok.sneakyThrow(e);
	}
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:22,代码来源:HandlerLibrary.java

示例2: loadAnnotationHandlers

import lombok.core.SpiLoadUtil; //导入依赖的package包/类
/** Uses SPI Discovery to find implementations of {@link EclipseAnnotationHandler}. */
@SuppressWarnings({"rawtypes", "unchecked"})
private static void loadAnnotationHandlers(HandlerLibrary lib) {
	try {
		for (EclipseAnnotationHandler<?> handler : SpiLoadUtil.findServices(EclipseAnnotationHandler.class, EclipseAnnotationHandler.class.getClassLoader())) {
			try {
				Class<? extends Annotation> annotationClass = handler.getAnnotationHandledByThisHandler();
				AnnotationHandlerContainer<?> container = new AnnotationHandlerContainer(handler, annotationClass);
				String annotationClassName = container.annotationClass.getName().replace("$", ".");
				if (lib.annotationHandlers.put(annotationClassName, container) != null) {
					error(null, "Duplicate handlers for annotation type: " + annotationClassName, null);
				}
				lib.typeLibrary.addType(container.annotationClass.getName());
			} catch (Throwable t) {
				error(null, "Can't load Lombok annotation handler for Eclipse: ", t);
			}
		}
	} catch (IOException e) {
		Lombok.sneakyThrow(e);
	}
}
 
开发者ID:redundent,项目名称:lombok,代码行数:22,代码来源:HandlerLibrary.java

示例3: autoDiscover

import lombok.core.SpiLoadUtil; //导入依赖的package包/类
static void autoDiscover(List<IdeLocation> locations, List<CorruptedIdeLocationException> problems) {
	try {
		for (IdeFinder finder : SpiLoadUtil.findServices(IdeFinder.class)) {
			finder.findIdes(locations, problems);
		}
	} catch (IOException e) {
		throw Lombok.sneakyThrow(e);
	}
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:10,代码来源:Installer.java

示例4: loadVisitorHandlers

import lombok.core.SpiLoadUtil; //导入依赖的package包/类
/** Uses SPI Discovery to find implementations of {@link EclipseASTVisitor}. */
private static void loadVisitorHandlers(HandlerLibrary lib) {
	try {
		for (EclipseASTVisitor visitor : SpiLoadUtil.findServices(EclipseASTVisitor.class, EclipseASTVisitor.class.getClassLoader())) {
			lib.visitorHandlers.add(new VisitorContainer(visitor));
		}
	} catch (Throwable t) {
		throw Lombok.sneakyThrow(t);
	}
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:11,代码来源:HandlerLibrary.java

示例5: loadAll

import lombok.core.SpiLoadUtil; //导入依赖的package包/类
private static void loadAll(TypeLibrary library, Map<String, EclipseSingularizer> map) throws IOException {
	for (EclipseSingularizer handler : SpiLoadUtil.findServices(EclipseSingularizer.class, EclipseSingularizer.class.getClassLoader())) {
		for (String type : handler.getSupportedTypes()) {
			EclipseSingularizer existingSingularizer = map.get(type);
			if (existingSingularizer != null) {
				EclipseSingularizer toKeep = existingSingularizer.getClass().getName().compareTo(handler.getClass().getName()) > 0 ? handler : existingSingularizer;
				System.err.println("Multiple singularizers found for type " + type + "; the alphabetically first class is used: " + toKeep.getClass().getName());
				map.put(type, toKeep);
			} else {
				map.put(type, handler);
				library.addType(type);
			}
		}
	}
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:16,代码来源:EclipseSingularsRecipes.java

示例6: loadAnnotationHandlers

import lombok.core.SpiLoadUtil; //导入依赖的package包/类
/** Uses SPI Discovery to find implementations of {@link JavacAnnotationHandler}. */
@SuppressWarnings({"rawtypes", "unchecked"})
private static void loadAnnotationHandlers(HandlerLibrary lib) throws IOException {
	//No, that seemingly superfluous reference to JavacAnnotationHandler's classloader is not in fact superfluous!
	for (JavacAnnotationHandler handler : SpiLoadUtil.findServices(JavacAnnotationHandler.class, JavacAnnotationHandler.class.getClassLoader())) {
		Class<? extends Annotation> annotationClass = handler.getAnnotationHandledByThisHandler();
		AnnotationHandlerContainer<?> container = new AnnotationHandlerContainer(handler, annotationClass);
		String annotationClassName = container.annotationClass.getName().replace("$", ".");
		if (lib.annotationHandlers.put(annotationClassName, container) != null) {
			lib.javacWarning("Duplicate handlers for annotation type: " + annotationClassName);
		}
		lib.typeLibrary.addType(container.annotationClass.getName());
	}
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:15,代码来源:HandlerLibrary.java

示例7: loadVisitorHandlers

import lombok.core.SpiLoadUtil; //导入依赖的package包/类
/** Uses SPI Discovery to find implementations of {@link JavacASTVisitor}. */
private static void loadVisitorHandlers(HandlerLibrary lib) throws IOException {
	//No, that seemingly superfluous reference to JavacASTVisitor's classloader is not in fact superfluous!
	for (JavacASTVisitor visitor : SpiLoadUtil.findServices(JavacASTVisitor.class, JavacASTVisitor.class.getClassLoader())) {
		lib.visitorHandlers.add(new VisitorContainer(visitor));
	}
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:8,代码来源:HandlerLibrary.java

示例8: loadAll

import lombok.core.SpiLoadUtil; //导入依赖的package包/类
private static void loadAll(TypeLibrary library, Map<String, JavacSingularizer> map) throws IOException {
	for (JavacSingularizer handler : SpiLoadUtil.findServices(JavacSingularizer.class, JavacSingularizer.class.getClassLoader())) {
		for (String type : handler.getSupportedTypes()) {
			JavacSingularizer existingSingularizer = map.get(type);
			if (existingSingularizer != null) {
				JavacSingularizer toKeep = existingSingularizer.getClass().getName().compareTo(handler.getClass().getName()) > 0 ? handler : existingSingularizer;
				System.err.println("Multiple singularizers found for type " + type + "; the alphabetically first class is used: " + toKeep.getClass().getName());
				map.put(type, toKeep);
			} else {
				map.put(type, handler);
				library.addType(type);
			}
		}
	}
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:16,代码来源:JavacSingularsRecipes.java

示例9: initializeInfoObjects

import lombok.core.SpiLoadUtil; //导入依赖的package包/类
private void initializeInfoObjects() throws IOException {
	infoObjects = SpiLoadUtil.readAllFromIterator(
			SpiLoadUtil.findServices(RuntimeDependencyInfo.class));
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:5,代码来源:CreateLombokRuntimeApp.java

示例10: getAnnotationHandledByThisHandler

import lombok.core.SpiLoadUtil; //导入依赖的package包/类
/**
 * This handler is a handler for the given annotation; you don't normally need to override this class
 * as the annotation type is extracted from your {@code extends EclipseAnnotationHandler<AnnotationTypeHere>}
 * signature.
 */
@SuppressWarnings("unchecked") public Class<T> getAnnotationHandledByThisHandler() {
	return (Class<T>) SpiLoadUtil.findAnnotationClass(getClass(), EclipseAnnotationHandler.class);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:9,代码来源:EclipseAnnotationHandler.java

示例11: getAnnotationHandledByThisHandler

import lombok.core.SpiLoadUtil; //导入依赖的package包/类
/**
 * This handler is a handler for the given annotation; you don't normally need to override this class
 * as the annotation type is extracted from your {@code extends EclipseAnnotationHandler<AnnotationTypeHere>}
 * signature.
 */
@SuppressWarnings("unchecked") public Class<T> getAnnotationHandledByThisHandler() {
	return (Class<T>) SpiLoadUtil.findAnnotationClass(getClass(), JavacAnnotationHandler.class);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:9,代码来源:JavacAnnotationHandler.java


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