From 4b3d28443c00a5445fff9db8dfdd90be88142cec Mon Sep 17 00:00:00 2001 From: GedMarc Date: Sun, 14 Apr 2024 05:32:00 +0200 Subject: [PATCH] Vert.x Configurators and build updates --- .../guicedee/guicedinjection/GuiceConfig.java | 26 ++++++++----------- .../guicedinjection/GuiceContext.java | 23 ++++++++-------- .../GuiceDefaultModuleExclusions.java | 5 ++-- .../GuiceDefaultModuleInclusions.java | 4 +-- 4 files changed, 25 insertions(+), 33 deletions(-) diff --git a/src/main/java/com/guicedee/guicedinjection/GuiceConfig.java b/src/main/java/com/guicedee/guicedinjection/GuiceConfig.java index 68dd78c..d3c046a 100644 --- a/src/main/java/com/guicedee/guicedinjection/GuiceConfig.java +++ b/src/main/java/com/guicedee/guicedinjection/GuiceConfig.java @@ -2,10 +2,6 @@ import com.google.inject.Singleton; -import jakarta.validation.constraints.NotNull; -import lombok.Getter; -import lombok.Setter; - /** * The configuration class for Guice Context and the Classpath Scanner */ @@ -127,7 +123,7 @@ public boolean isFieldScanning() @Override @SuppressWarnings("unchecked") - @NotNull + public J setFieldScanning(boolean fieldScanning) { this.fieldScanning = fieldScanning; @@ -142,7 +138,7 @@ public boolean isAnnotationScanning() @Override @SuppressWarnings("unchecked") - @NotNull + public J setAnnotationScanning(boolean annotationScanning) { this.annotationScanning = annotationScanning; @@ -157,7 +153,7 @@ public boolean isMethodInfo() @Override @SuppressWarnings("unchecked") - @NotNull + public J setMethodInfo(boolean methodInfo) { this.methodInfo = methodInfo; @@ -172,7 +168,7 @@ public boolean isIgnoreFieldVisibility() @Override @SuppressWarnings("unchecked") - @NotNull + public J setIgnoreFieldVisibility(boolean ignoreFieldVisibility) { this.ignoreFieldVisibility = ignoreFieldVisibility; @@ -187,7 +183,7 @@ public boolean isIgnoreMethodVisibility() @Override @SuppressWarnings("unchecked") - @NotNull + public J setIgnoreMethodVisibility(boolean ignoreMethodVisibility) { this.ignoreMethodVisibility = ignoreMethodVisibility; @@ -202,7 +198,7 @@ public boolean isIncludePackages() @Override @SuppressWarnings("unchecked") - @NotNull + public J setIncludePackages(boolean includePackages) { this.includePackages = includePackages; @@ -217,7 +213,7 @@ public boolean isFieldInfo() @Override @SuppressWarnings("unchecked") - @NotNull + public J setFieldInfo(boolean fieldInfo) { this.fieldInfo = fieldInfo; @@ -232,7 +228,7 @@ public boolean isVerbose() @Override @SuppressWarnings("unchecked") - @NotNull + public J setVerbose(boolean verbose) { this.verbose = verbose; @@ -248,7 +244,7 @@ public boolean isClasspathScanning() @Override @SuppressWarnings("unchecked") - @NotNull + public J setClasspathScanning(boolean classpathScanning) { this.classpathScanning = classpathScanning; @@ -263,7 +259,7 @@ public boolean isExcludeModulesAndJars() @Override @SuppressWarnings("unchecked") - @NotNull + public J setExcludeModulesAndJars(boolean excludeModulesAndJars) { this.excludeModulesAndJars = excludeModulesAndJars; @@ -278,7 +274,7 @@ public boolean isExcludePaths() @Override @SuppressWarnings("unchecked") - @NotNull + public J setExcludePaths(boolean excludePaths) { this.excludePaths = excludePaths; diff --git a/src/main/java/com/guicedee/guicedinjection/GuiceContext.java b/src/main/java/com/guicedee/guicedinjection/GuiceContext.java index dbbc63b..24cf021 100644 --- a/src/main/java/com/guicedee/guicedinjection/GuiceContext.java +++ b/src/main/java/com/guicedee/guicedinjection/GuiceContext.java @@ -21,7 +21,6 @@ import com.guicedee.client.*; import com.guicedee.guicedinjection.interfaces.*; import io.github.classgraph.*; -import jakarta.validation.constraints.*; import lombok.extern.java.*; import java.util.*; @@ -96,7 +95,7 @@ private GuiceContext() * * @return The global Guice Injector Object, Never Null, Instantiates the Injector if not configured */ - @NotNull + public synchronized Injector inject() { if (GuiceContext.buildingInjector) @@ -240,7 +239,7 @@ private static int getJavaVersion() * * @return The physical Scan Result from the complete class scanner */ - @NotNull + public ScanResult getScanResult() { if (scanResult == null) @@ -722,7 +721,7 @@ private Map quickScanFilesPattern() * @return A set of them */ @SuppressWarnings("unchecked") - @NotNull + public Set getLoader(Class loaderType, @SuppressWarnings("unused") boolean dontInject, ServiceLoader serviceLoader) { if (!IGuiceContext @@ -842,7 +841,7 @@ public GuiceConfig getConfig() * * @return The list of guice post startups */ - public @NotNull Set loadPostStartupServices() + public Set loadPostStartupServices() { return getLoader(IGuicePostStartup.class, ServiceLoader.load(IGuicePostStartup.class)); } @@ -852,7 +851,7 @@ public GuiceConfig getConfig() * * @return The list of guice post startups */ - public @NotNull Set loadPathRejectScanners() + public Set loadPathRejectScanners() { return getLoader(IPathContentsRejectListScanner.class, true, ServiceLoader.load(IPathContentsRejectListScanner.class)); } @@ -863,7 +862,7 @@ public GuiceConfig getConfig() * * @return The list of guice post startups */ - public @NotNull Set loadJarRejectScanners() + public Set loadJarRejectScanners() { return getLoader(IGuiceScanJarExclusions.class, true, ServiceLoader.load(IGuiceScanJarExclusions.class)); } @@ -874,7 +873,7 @@ public GuiceConfig getConfig() * * @return The list of guice post startups */ - public @NotNull Set loadJarInclusionScanners() + public Set loadJarInclusionScanners() { return getLoader(IGuiceScanJarInclusions.class, true, ServiceLoader.load(IGuiceScanJarInclusions.class)); } @@ -885,7 +884,7 @@ public GuiceConfig getConfig() * * @return The list of guice post startups */ - public @NotNull Set loadPreStartupServices() + public Set loadPreStartupServices() { return getLoader(IGuicePreStartup.class, true, ServiceLoader.load(IGuicePreStartup.class)); } @@ -895,7 +894,7 @@ public GuiceConfig getConfig() * * @return The list of guice post startups */ - public @NotNull Set loadIGuiceModules() + public Set loadIGuiceModules() { return getLoader(IGuiceModule.class, true, ServiceLoader.load(IGuiceModule.class)); } @@ -905,7 +904,7 @@ public GuiceConfig getConfig() * * @return The list of guice configs */ - public @NotNull Set loadIGuiceConfigs() + public Set loadIGuiceConfigs() { return getLoader(IGuiceConfigurator.class, true, ServiceLoader.load(IGuiceConfigurator.class)); } @@ -936,7 +935,7 @@ private void loadPreStartups() * @return A set of them */ @SuppressWarnings("unchecked") - @NotNull + public > Set getLoader(Class loaderType, ServiceLoader serviceLoader) { if (!IGuiceContext diff --git a/src/main/java/com/guicedee/guicedinjection/implementations/GuiceDefaultModuleExclusions.java b/src/main/java/com/guicedee/guicedinjection/implementations/GuiceDefaultModuleExclusions.java index 6341e12..b629aed 100644 --- a/src/main/java/com/guicedee/guicedinjection/implementations/GuiceDefaultModuleExclusions.java +++ b/src/main/java/com/guicedee/guicedinjection/implementations/GuiceDefaultModuleExclusions.java @@ -3,7 +3,6 @@ import com.guicedee.guicedinjection.interfaces.IGuiceScanJarExclusions; import com.guicedee.guicedinjection.interfaces.IGuiceScanModuleExclusions; -import jakarta.validation.constraints.NotNull; import java.util.HashSet; import java.util.Set; @@ -11,7 +10,7 @@ public class GuiceDefaultModuleExclusions implements IGuiceScanModuleExclusions, IGuiceScanJarExclusions { @Override - public @NotNull + public Set excludeModules() { Set strings = new HashSet<>(); @@ -101,7 +100,7 @@ Set excludeModules() } @Override - public @NotNull Set excludeJars() { + public Set excludeJars() { Set strings = new HashSet<>(); strings.add("activation-*"); strings.add("adal4j-*"); diff --git a/src/main/java/com/guicedee/guicedinjection/implementations/GuiceDefaultModuleInclusions.java b/src/main/java/com/guicedee/guicedinjection/implementations/GuiceDefaultModuleInclusions.java index 0897d12..bfbffd7 100644 --- a/src/main/java/com/guicedee/guicedinjection/implementations/GuiceDefaultModuleInclusions.java +++ b/src/main/java/com/guicedee/guicedinjection/implementations/GuiceDefaultModuleInclusions.java @@ -1,7 +1,6 @@ package com.guicedee.guicedinjection.implementations; import com.guicedee.guicedinjection.interfaces.IGuiceScanModuleInclusions; -import jakarta.validation.constraints.NotNull; import java.util.HashSet; import java.util.Set; @@ -10,8 +9,7 @@ public class GuiceDefaultModuleInclusions implements IGuiceScanModuleInclusions { @Override - public @NotNull - Set includeModules() + public Set includeModules() { Set strings = new HashSet<>(); return strings;