本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
}
}
示例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());
}
}
示例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));
}
}
示例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);
}
}
}
}
示例9: initializeInfoObjects
import lombok.core.SpiLoadUtil; //导入依赖的package包/类
private void initializeInfoObjects() throws IOException {
infoObjects = SpiLoadUtil.readAllFromIterator(
SpiLoadUtil.findServices(RuntimeDependencyInfo.class));
}
示例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);
}
示例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);
}