From 27ec6372822065fdb2331b76250e489730c9eba3 Mon Sep 17 00:00:00 2001 From: Bruno Martins Date: Fri, 17 Jan 2025 13:49:36 -0300 Subject: [PATCH] feat: remove hard-coded paths on AccessorProxyGenerator --- common/gradle.lockfile | 4 +-- context/gradle.lockfile | 5 ++-- gateway-generator/gradle.lockfile | 4 +-- .../mx/path/api/AccessorProxyGenerator.java | 18 ++++++++----- gateway/gradle.lockfile | 5 ++-- http/gradle.lockfile | 5 ++-- messaging/gradle.lockfile | 5 ++-- test-gateway-generator/gradle.lockfile | 4 +-- test-gateways/gradle.lockfile | 6 ++--- test-models/gradle.lockfile | 5 ++-- testing/gradle.lockfile | 27 ++++++++++--------- utilities/build.gradle | 2 ++ utilities/gradle.lockfile | 1 + .../core/utility/reflection/ClassHelper.java | 12 +++++++++ 14 files changed, 64 insertions(+), 39 deletions(-) diff --git a/common/gradle.lockfile b/common/gradle.lockfile index 1c1ac183..69cc7890 100644 --- a/common/gradle.lockfile +++ b/common/gradle.lockfile @@ -36,10 +36,10 @@ org.antlr:antlr4-runtime:4.7.2=pmd org.antlr:antlr4-runtime:4.8-1=checkstyle org.apache.bcel:bcel:6.5.0=spotbugs org.apache.commons:commons-lang3:3.12.0=spotbugs -org.apache.commons:commons-lang3:3.14.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.commons:commons-lang3:3.17.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.commons:commons-lang3:3.8.1=pmd org.apache.commons:commons-text:1.10.0=spotbugs -org.apache.commons:commons-text:1.12.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.commons:commons-text:1.13.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.groovy:groovy-bom:4.0.6=testCompileClasspath,testRuntimeClasspath org.apache.groovy:groovy:4.0.6=testCompileClasspath,testRuntimeClasspath org.apache.httpcomponents.client5:httpclient5:5.1.3=spotbugs diff --git a/context/gradle.lockfile b/context/gradle.lockfile index 062dd66d..dc723ea1 100644 --- a/context/gradle.lockfile +++ b/context/gradle.lockfile @@ -23,6 +23,7 @@ com.google.guava:guava:31.1-jre=compileClasspath,runtimeClasspath,testCompileCla com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath com.google.j2objc:j2objc-annotations:1.3=checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath com.puppycrawl.tools:checkstyle:8.29=checkstyle +com.squareup:javapoet:1.13.0=runtimeClasspath,testRuntimeClasspath commons-beanutils:commons-beanutils:1.9.4=checkstyle commons-codec:commons-codec:1.15=spotbugs commons-collections:commons-collections:3.2.2=checkstyle @@ -46,10 +47,10 @@ org.antlr:antlr4-runtime:4.7.2=pmd org.antlr:antlr4-runtime:4.8-1=checkstyle org.apache.bcel:bcel:6.5.0=spotbugs org.apache.commons:commons-lang3:3.12.0=spotbugs -org.apache.commons:commons-lang3:3.14.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.commons:commons-lang3:3.17.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.commons:commons-lang3:3.8.1=pmd org.apache.commons:commons-text:1.10.0=spotbugs -org.apache.commons:commons-text:1.12.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.commons:commons-text:1.13.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.groovy:groovy-bom:4.0.6=testCompileClasspath,testRuntimeClasspath org.apache.groovy:groovy:4.0.6=testCompileClasspath,testRuntimeClasspath org.apache.httpcomponents.client5:httpclient5:5.1.3=spotbugs diff --git a/gateway-generator/gradle.lockfile b/gateway-generator/gradle.lockfile index 0835835f..1fbb6239 100644 --- a/gateway-generator/gradle.lockfile +++ b/gateway-generator/gradle.lockfile @@ -59,10 +59,10 @@ org.antlr:antlr4-runtime:4.7.2=pmd org.antlr:antlr4-runtime:4.8-1=checkstyle org.apache.bcel:bcel:6.5.0=spotbugs org.apache.commons:commons-lang3:3.12.0=spotbugs -org.apache.commons:commons-lang3:3.14.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.commons:commons-lang3:3.17.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.commons:commons-lang3:3.8.1=pmd org.apache.commons:commons-text:1.10.0=spotbugs -org.apache.commons:commons-text:1.12.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.commons:commons-text:1.13.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.groovy:groovy-bom:4.0.6=testCompileClasspath,testRuntimeClasspath org.apache.groovy:groovy:4.0.6=testCompileClasspath,testRuntimeClasspath org.apache.httpcomponents.client5:httpclient5:5.1.3=spotbugs diff --git a/gateway-generator/src/main/java/com/mx/path/api/AccessorProxyGenerator.java b/gateway-generator/src/main/java/com/mx/path/api/AccessorProxyGenerator.java index 23463ba6..fbbc9843 100644 --- a/gateway-generator/src/main/java/com/mx/path/api/AccessorProxyGenerator.java +++ b/gateway-generator/src/main/java/com/mx/path/api/AccessorProxyGenerator.java @@ -18,8 +18,12 @@ import com.mx.path.core.common.gateway.GatewayAPI; import com.mx.path.core.common.lang.Strings; import com.mx.path.core.common.reflection.Annotations; +import com.mx.path.core.utility.reflection.ClassHelper; import com.mx.path.gateway.accessor.Accessor; import com.mx.path.gateway.accessor.AccessorConfiguration; +import com.mx.path.gateway.configuration.AccessorConstructionContext; +import com.mx.path.gateway.configuration.AccessorProxy; +import com.mx.path.gateway.configuration.AccessorProxyMap; import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.FieldSpec; @@ -42,7 +46,7 @@ public class AccessorProxyGenerator { /** * Build new {@link AccessorProxyGenerator} instance with provided processing environment. * - * @param processingEnvironment processing environment to interact with {@link Filer} file generation. + q* @param processingEnvironment processing environment to interact with {@link Filer} file generation. */ public AccessorProxyGenerator(ProcessingEnvironment processingEnvironment) { this.filer = processingEnvironment.getFiler(); @@ -61,7 +65,7 @@ public final CodeBlock generateAll(Class rootAccessor) throw } accessorProxyMappings = CodeBlock.builder(); recursiveGenerate(rootAccessor); - accessorProxyMappings.addStatement("$T.freeze()", ClassName.get("com.mx.path.gateway.configuration", "AccessorProxyMap")); + accessorProxyMappings.addStatement("$T.freeze()", ClassHelper.buildClassName(AccessorProxyMap.class)); return accessorProxyMappings.build(); } @@ -75,7 +79,7 @@ private void recursiveGenerate(Class klass) throws IOExcepti TypeSpec.Builder classBuilder = TypeSpec.classBuilder(proxyName) .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT) .superclass(klass) - .addSuperinterface(ClassName.get("com.mx.path.gateway.configuration", "AccessorProxy")) + .addSuperinterface(ClassHelper.buildClassName(AccessorProxy.class)) .addJavadoc( "Base class for wrapping " + klass.getName() + ".\n" @@ -88,11 +92,11 @@ private void recursiveGenerate(Class klass) throws IOExcepti .addParameter(AccessorConfiguration.class, "configuration") .addParameter(ParameterizedTypeName.get(ClassName.get(Class.class), WildcardTypeName.subtypeOf(klass)), "accessorClass") .addStatement("this.setConfiguration(configuration)") - .addStatement("this.accessorConstructionContext = new $T(accessorClass, configuration)", ParameterizedTypeName.get(ClassName.get("com.mx.path.gateway.configuration", "AccessorConstructionContext"), TypeName.get(klass))) + .addStatement("this.accessorConstructionContext = new $T(accessorClass, configuration)", ParameterizedTypeName.get(ClassHelper.buildClassName(AccessorConstructionContext.class), TypeName.get(klass))) .build()) .addField( - FieldSpec.builder(ParameterizedTypeName.get(ClassName.get("com.mx.path.gateway.configuration", "AccessorConstructionContext"), WildcardTypeName.subtypeOf(klass)), "accessorConstructionContext") + FieldSpec.builder(ParameterizedTypeName.get(ClassHelper.buildClassName(AccessorConstructionContext.class), WildcardTypeName.subtypeOf(klass)), "accessorConstructionContext") .addModifiers(Modifier.PRIVATE, Modifier.FINAL) .addAnnotation(ClassName.get("lombok", "Getter")) .build()) @@ -233,7 +237,7 @@ private void generateSingletonProxy(String proxyBaseClass, Class accessorClass) throws IOException { @@ -270,7 +274,7 @@ private void generatePrototypeProxy(String proxyBaseClass, Class accessorClass) { diff --git a/gateway/gradle.lockfile b/gateway/gradle.lockfile index 085b951a..0a3d40ad 100644 --- a/gateway/gradle.lockfile +++ b/gateway/gradle.lockfile @@ -24,6 +24,7 @@ com.google.guava:guava:31.1-jre=compileClasspath,runtimeClasspath,testCompileCla com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath com.google.j2objc:j2objc-annotations:1.3=checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath com.puppycrawl.tools:checkstyle:8.29=checkstyle +com.squareup:javapoet:1.13.0=runtimeClasspath,testRuntimeClasspath com.sun.activation:jakarta.activation:1.2.2=runtimeClasspath,testRuntimeClasspath com.sun.istack:istack-commons-runtime:3.0.12=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath com.sun.xml.bind:jaxb-impl:2.3.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath @@ -56,10 +57,10 @@ org.antlr:antlr4-runtime:4.7.2=pmd org.antlr:antlr4-runtime:4.8-1=checkstyle org.apache.bcel:bcel:6.5.0=spotbugs org.apache.commons:commons-lang3:3.12.0=spotbugs -org.apache.commons:commons-lang3:3.14.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.commons:commons-lang3:3.17.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.commons:commons-lang3:3.8.1=pmd org.apache.commons:commons-text:1.10.0=spotbugs -org.apache.commons:commons-text:1.12.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.commons:commons-text:1.13.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.groovy:groovy-bom:4.0.6=testCompileClasspath,testRuntimeClasspath org.apache.groovy:groovy:4.0.6=testCompileClasspath,testRuntimeClasspath org.apache.httpcomponents.client5:httpclient5:5.1.3=spotbugs diff --git a/http/gradle.lockfile b/http/gradle.lockfile index 4a872a32..0484745d 100644 --- a/http/gradle.lockfile +++ b/http/gradle.lockfile @@ -24,6 +24,7 @@ com.google.guava:guava:31.1-jre=compileClasspath,runtimeClasspath,testCompileCla com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath com.google.j2objc:j2objc-annotations:1.3=checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath com.puppycrawl.tools:checkstyle:8.29=checkstyle +com.squareup:javapoet:1.13.0=runtimeClasspath,testRuntimeClasspath com.sun.activation:jakarta.activation:1.2.2=runtimeClasspath,testRuntimeClasspath com.sun.istack:istack-commons-runtime:3.0.12=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath com.sun.xml.bind:jaxb-impl:2.3.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath @@ -56,10 +57,10 @@ org.antlr:antlr4-runtime:4.7.2=pmd org.antlr:antlr4-runtime:4.8-1=checkstyle org.apache.bcel:bcel:6.5.0=spotbugs org.apache.commons:commons-lang3:3.12.0=spotbugs -org.apache.commons:commons-lang3:3.14.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.commons:commons-lang3:3.17.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.commons:commons-lang3:3.8.1=pmd org.apache.commons:commons-text:1.10.0=spotbugs -org.apache.commons:commons-text:1.12.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.commons:commons-text:1.13.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.groovy:groovy-bom:4.0.6=testCompileClasspath,testRuntimeClasspath org.apache.groovy:groovy:4.0.6=testCompileClasspath,testRuntimeClasspath org.apache.httpcomponents.client5:httpclient5:5.1.3=spotbugs diff --git a/messaging/gradle.lockfile b/messaging/gradle.lockfile index 5d490a86..f0189fb4 100644 --- a/messaging/gradle.lockfile +++ b/messaging/gradle.lockfile @@ -23,6 +23,7 @@ com.google.guava:guava:31.1-jre=compileClasspath,runtimeClasspath,testCompileCla com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath com.google.j2objc:j2objc-annotations:1.3=checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath com.puppycrawl.tools:checkstyle:8.29=checkstyle +com.squareup:javapoet:1.13.0=runtimeClasspath,testRuntimeClasspath commons-beanutils:commons-beanutils:1.9.4=checkstyle commons-codec:commons-codec:1.15=spotbugs commons-collections:commons-collections:3.2.2=checkstyle @@ -47,10 +48,10 @@ org.antlr:antlr4-runtime:4.7.2=pmd org.antlr:antlr4-runtime:4.8-1=checkstyle org.apache.bcel:bcel:6.5.0=spotbugs org.apache.commons:commons-lang3:3.12.0=spotbugs -org.apache.commons:commons-lang3:3.14.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.commons:commons-lang3:3.17.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.commons:commons-lang3:3.8.1=pmd org.apache.commons:commons-text:1.10.0=spotbugs -org.apache.commons:commons-text:1.12.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.commons:commons-text:1.13.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.groovy:groovy-bom:4.0.6=testCompileClasspath,testRuntimeClasspath org.apache.groovy:groovy:4.0.6=testCompileClasspath,testRuntimeClasspath org.apache.httpcomponents.client5:httpclient5:5.1.3=spotbugs diff --git a/test-gateway-generator/gradle.lockfile b/test-gateway-generator/gradle.lockfile index 22407c8f..cad2e6eb 100644 --- a/test-gateway-generator/gradle.lockfile +++ b/test-gateway-generator/gradle.lockfile @@ -45,9 +45,9 @@ net.jcip:jcip-annotations:1.0=spotbugs net.sf.saxon:Saxon-HE:11.4=spotbugs org.apache.bcel:bcel:6.5.0=spotbugs org.apache.commons:commons-lang3:3.12.0=spotbugs -org.apache.commons:commons-lang3:3.14.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.commons:commons-lang3:3.17.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.commons:commons-text:1.10.0=spotbugs -org.apache.commons:commons-text:1.12.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.commons:commons-text:1.13.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.groovy:groovy-bom:4.0.6=testCompileClasspath,testRuntimeClasspath org.apache.groovy:groovy:4.0.6=testCompileClasspath,testRuntimeClasspath org.apache.httpcomponents.client5:httpclient5:5.1.3=spotbugs diff --git a/test-gateways/gradle.lockfile b/test-gateways/gradle.lockfile index 867e3cf4..8920eda4 100644 --- a/test-gateways/gradle.lockfile +++ b/test-gateways/gradle.lockfile @@ -29,7 +29,7 @@ com.google.guava:guava:31.1-jre=compileClasspath,runtimeClasspath,testCompileCla com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=annotationProcessor,checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath com.google.j2objc:j2objc-annotations:1.3=annotationProcessor,checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath com.puppycrawl.tools:checkstyle:8.29=checkstyle -com.squareup:javapoet:1.13.0=annotationProcessor +com.squareup:javapoet:1.13.0=annotationProcessor,runtimeClasspath,testRuntimeClasspath com.sun.activation:jakarta.activation:1.2.2=annotationProcessor,runtimeClasspath,testRuntimeClasspath com.sun.istack:istack-commons-runtime:3.0.12=annotationProcessor,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath com.sun.xml.bind:jaxb-impl:2.3.1=annotationProcessor,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath @@ -61,10 +61,10 @@ org.antlr:antlr4-runtime:4.7.2=pmd org.antlr:antlr4-runtime:4.8-1=checkstyle org.apache.bcel:bcel:6.5.0=spotbugs org.apache.commons:commons-lang3:3.12.0=spotbugs -org.apache.commons:commons-lang3:3.14.0=annotationProcessor,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.commons:commons-lang3:3.17.0=annotationProcessor,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.commons:commons-lang3:3.8.1=pmd org.apache.commons:commons-text:1.10.0=spotbugs -org.apache.commons:commons-text:1.12.0=annotationProcessor,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.commons:commons-text:1.13.0=annotationProcessor,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.groovy:groovy-bom:4.0.6=testCompileClasspath,testRuntimeClasspath org.apache.groovy:groovy:4.0.6=testCompileClasspath,testRuntimeClasspath org.apache.httpcomponents.client5:httpclient5:5.1.3=spotbugs diff --git a/test-models/gradle.lockfile b/test-models/gradle.lockfile index f4a2729e..abc78937 100644 --- a/test-models/gradle.lockfile +++ b/test-models/gradle.lockfile @@ -24,6 +24,7 @@ com.google.guava:guava:31.1-jre=compileClasspath,runtimeClasspath,testCompileCla com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath com.google.j2objc:j2objc-annotations:1.3=checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath com.puppycrawl.tools:checkstyle:8.29=checkstyle +com.squareup:javapoet:1.13.0=runtimeClasspath,testRuntimeClasspath com.sun.activation:jakarta.activation:1.2.2=runtimeClasspath,testRuntimeClasspath com.sun.istack:istack-commons-runtime:3.0.12=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath com.sun.xml.bind:jaxb-impl:2.3.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath @@ -55,10 +56,10 @@ org.antlr:antlr4-runtime:4.7.2=pmd org.antlr:antlr4-runtime:4.8-1=checkstyle org.apache.bcel:bcel:6.5.0=spotbugs org.apache.commons:commons-lang3:3.12.0=spotbugs -org.apache.commons:commons-lang3:3.14.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.commons:commons-lang3:3.17.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.commons:commons-lang3:3.8.1=pmd org.apache.commons:commons-text:1.10.0=spotbugs -org.apache.commons:commons-text:1.12.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.commons:commons-text:1.13.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.groovy:groovy-bom:4.0.6=testCompileClasspath,testRuntimeClasspath org.apache.groovy:groovy:4.0.6=testCompileClasspath,testRuntimeClasspath org.apache.httpcomponents.client5:httpclient5:5.1.3=spotbugs diff --git a/testing/gradle.lockfile b/testing/gradle.lockfile index 1c1f3d3a..da2f89fc 100644 --- a/testing/gradle.lockfile +++ b/testing/gradle.lockfile @@ -24,6 +24,7 @@ com.google.guava:guava:31.1-jre=compileClasspath,runtimeClasspath,testCompileCla com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath com.google.j2objc:j2objc-annotations:1.3=checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath com.puppycrawl.tools:checkstyle:8.29=checkstyle +com.squareup:javapoet:1.13.0=runtimeClasspath,testRuntimeClasspath com.sun.activation:jakarta.activation:1.2.2=runtimeClasspath,testRuntimeClasspath com.sun.istack:istack-commons-runtime:3.0.12=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath com.sun.xml.bind:jaxb-impl:2.3.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath @@ -36,7 +37,7 @@ commons-lang:commons-lang:2.6=runtimeClasspath,testRuntimeClasspath commons-logging:commons-logging:1.2=runtimeClasspath,testRuntimeClasspath info.picocli:picocli:4.1.4=checkstyle io.github.cdimascio:dotenv-java:2.3.2=runtimeClasspath,testRuntimeClasspath -io.leangen.geantyref:geantyref:1.3.15=runtimeClasspath,testRuntimeClasspath +io.leangen.geantyref:geantyref:1.3.16=runtimeClasspath,testRuntimeClasspath io.opentracing:opentracing-api:0.33.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath io.opentracing:opentracing-noop:0.33.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath io.opentracing:opentracing-util:0.33.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath @@ -57,12 +58,12 @@ org.antlr:antlr4-runtime:4.7.2=pmd org.antlr:antlr4-runtime:4.8-1=checkstyle org.apache.bcel:bcel:6.5.0=spotbugs org.apache.commons:commons-lang3:3.12.0=spotbugs -org.apache.commons:commons-lang3:3.14.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.commons:commons-lang3:3.17.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.commons:commons-lang3:3.8.1=pmd org.apache.commons:commons-text:1.10.0=spotbugs -org.apache.commons:commons-text:1.12.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.apache.groovy:groovy-bom:4.0.20=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.apache.groovy:groovy:4.0.20=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.commons:commons-text:1.13.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.groovy:groovy-bom:4.0.24=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.groovy:groovy:4.0.24=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.httpcomponents.client5:httpclient5:5.1.3=spotbugs org.apache.httpcomponents.core5:httpcore5-h2:5.1.3=spotbugs org.apache.httpcomponents.core5:httpcore5:5.1.3=spotbugs @@ -77,17 +78,17 @@ org.dom4j:dom4j:2.1.3=spotbugs org.glassfish.jaxb:jaxb-runtime:2.3.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.glassfish.jaxb:txw2:2.3.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.hamcrest:hamcrest-core:1.3=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.hamcrest:hamcrest:2.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hamcrest:hamcrest:3.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.jacoco:org.jacoco.agent:0.8.8=jacocoAgent,jacocoAnt org.jacoco:org.jacoco.ant:0.8.8=jacocoAnt org.jacoco:org.jacoco.core:0.8.8=jacocoAnt org.jacoco:org.jacoco.report:0.8.8=jacocoAnt org.javassist:javassist:3.28.0-GA=runtimeClasspath,testRuntimeClasspath -org.junit.jupiter:junit-jupiter-api:5.10.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.junit.jupiter:junit-jupiter-engine:5.10.2=runtimeClasspath,testRuntimeClasspath -org.junit.platform:junit-platform-commons:1.10.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.junit.platform:junit-platform-engine:1.10.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.junit:junit-bom:5.10.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter-api:5.11.4=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter-engine:5.11.4=runtimeClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-commons:1.11.4=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-engine:1.11.4=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.junit:junit-bom:5.11.4=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.junit:junit-bom:5.9.1=spotbugs org.mockito:mockito-core:4.11.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.mockito:mockito-inline:4.11.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath @@ -108,8 +109,8 @@ org.reflections:reflections:0.10.2=runtimeClasspath,testRuntimeClasspath org.slf4j:slf4j-api:1.7.32=runtimeClasspath,testRuntimeClasspath org.slf4j:slf4j-api:2.0.0=spotbugs,spotbugsSlf4j org.slf4j:slf4j-simple:2.0.0=spotbugsSlf4j -org.spockframework:spock-core:2.4-M4-groovy-4.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.spockframework:spock-junit4:2.4-M4-groovy-4.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.spockframework:spock-core:2.4-M5-groovy-4.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.spockframework:spock-junit4:2.4-M5-groovy-4.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.xmlresolver:xmlresolver:4.4.3=spotbugs org.yaml:snakeyaml:1.33=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath xml-apis:xml-apis:1.4.01=spotbugs diff --git a/utilities/build.gradle b/utilities/build.gradle index 5086de7a..60dca1b2 100644 --- a/utilities/build.gradle +++ b/utilities/build.gradle @@ -7,6 +7,8 @@ coppuccino { dependencies { api "com.auth0:java-jwt:[4.0,5.0[" // For JWT Parsing Library + implementation "com.squareup:javapoet:1.13.0" + constraints { implementation("com.fasterxml.jackson.core:jackson-databind:2.14.0-rc1") { because "previous versions are vulnerable to CVE-2022-42003 and CVE-2022-42004" diff --git a/utilities/gradle.lockfile b/utilities/gradle.lockfile index c2bccd92..a91be7b7 100644 --- a/utilities/gradle.lockfile +++ b/utilities/gradle.lockfile @@ -19,6 +19,7 @@ com.google.guava:guava:28.2-jre=checkstyle com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=checkstyle com.google.j2objc:j2objc-annotations:1.3=checkstyle com.puppycrawl.tools:checkstyle:8.29=checkstyle +com.squareup:javapoet:1.13.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath commons-beanutils:commons-beanutils:1.9.4=checkstyle commons-codec:commons-codec:1.15=spotbugs commons-collections:commons-collections:3.2.2=checkstyle diff --git a/utilities/src/main/java/com/mx/path/core/utility/reflection/ClassHelper.java b/utilities/src/main/java/com/mx/path/core/utility/reflection/ClassHelper.java index ebef0511..a93a2671 100644 --- a/utilities/src/main/java/com/mx/path/core/utility/reflection/ClassHelper.java +++ b/utilities/src/main/java/com/mx/path/core/utility/reflection/ClassHelper.java @@ -18,6 +18,8 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import com.squareup.javapoet.ClassName; + /** * Utility class with methods based on java standard types and functions. */ @@ -325,4 +327,14 @@ public final List resolveParameterizedTypes(Type parameterizedType) { Type[] actualTypeArguments = ((ParameterizedType) parameterizedType).getActualTypeArguments(); return Arrays.asList(actualTypeArguments); } + + /** + * Build and return new {@link ClassName} from class. + * + * @param clazz class to build from + * @return new {@link ClassName} instance + */ + public static ClassName buildClassName(Class clazz) { + return ClassName.get(clazz.getPackage().getName(), clazz.getSimpleName()); + } }