1818import com .mx .path .core .common .gateway .GatewayAPI ;
1919import com .mx .path .core .common .lang .Strings ;
2020import com .mx .path .core .common .reflection .Annotations ;
21+ import com .mx .path .core .utility .reflection .ClassHelper ;
2122import com .mx .path .gateway .accessor .Accessor ;
2223import com .mx .path .gateway .accessor .AccessorConfiguration ;
24+ import com .mx .path .gateway .configuration .AccessorConstructionContext ;
25+ import com .mx .path .gateway .configuration .AccessorProxy ;
26+ import com .mx .path .gateway .configuration .AccessorProxyMap ;
2327import com .squareup .javapoet .ClassName ;
2428import com .squareup .javapoet .CodeBlock ;
2529import com .squareup .javapoet .FieldSpec ;
@@ -42,7 +46,7 @@ public class AccessorProxyGenerator {
4246 /**
4347 * Build new {@link AccessorProxyGenerator} instance with provided processing environment.
4448 *
45- * @param processingEnvironment processing environment to interact with {@link Filer} file generation.
49+ q * @param processingEnvironment processing environment to interact with {@link Filer} file generation.
4650 */
4751 public AccessorProxyGenerator (ProcessingEnvironment processingEnvironment ) {
4852 this .filer = processingEnvironment .getFiler ();
@@ -61,7 +65,7 @@ public final CodeBlock generateAll(Class<? extends Accessor> rootAccessor) throw
6165 }
6266 accessorProxyMappings = CodeBlock .builder ();
6367 recursiveGenerate (rootAccessor );
64- accessorProxyMappings .addStatement ("$T.freeze()" , ClassName . get ( "com.mx.path.gateway.configuration" , " AccessorProxyMap" ));
68+ accessorProxyMappings .addStatement ("$T.freeze()" , ClassHelper . buildClassName ( AccessorProxyMap . class ));
6569
6670 return accessorProxyMappings .build ();
6771 }
@@ -75,7 +79,7 @@ private void recursiveGenerate(Class<? extends Accessor> klass) throws IOExcepti
7579 TypeSpec .Builder classBuilder = TypeSpec .classBuilder (proxyName )
7680 .addModifiers (Modifier .PUBLIC , Modifier .ABSTRACT )
7781 .superclass (klass )
78- .addSuperinterface (ClassName . get ( "com.mx.path.gateway.configuration" , " AccessorProxy" ))
82+ .addSuperinterface (ClassHelper . buildClassName ( AccessorProxy . class ))
7983
8084 .addJavadoc (
8185 "Base class for wrapping " + klass .getName () + ".\n "
@@ -88,11 +92,11 @@ private void recursiveGenerate(Class<? extends Accessor> klass) throws IOExcepti
8892 .addParameter (AccessorConfiguration .class , "configuration" )
8993 .addParameter (ParameterizedTypeName .get (ClassName .get (Class .class ), WildcardTypeName .subtypeOf (klass )), "accessorClass" )
9094 .addStatement ("this.setConfiguration(configuration)" )
91- .addStatement ("this.accessorConstructionContext = new $T(accessorClass, configuration)" , ParameterizedTypeName .get (ClassName . get ( "com.mx.path.gateway.configuration" , " AccessorConstructionContext" ), TypeName .get (klass )))
95+ .addStatement ("this.accessorConstructionContext = new $T(accessorClass, configuration)" , ParameterizedTypeName .get (ClassHelper . buildClassName ( AccessorConstructionContext . class ), TypeName .get (klass )))
9296 .build ())
9397
9498 .addField (
95- FieldSpec .builder (ParameterizedTypeName .get (ClassName . get ( "com.mx.path.gateway.configuration" , " AccessorConstructionContext" ), WildcardTypeName .subtypeOf (klass )), "accessorConstructionContext" )
99+ FieldSpec .builder (ParameterizedTypeName .get (ClassHelper . buildClassName ( AccessorConstructionContext . class ), WildcardTypeName .subtypeOf (klass )), "accessorConstructionContext" )
96100 .addModifiers (Modifier .PRIVATE , Modifier .FINAL )
97101 .addAnnotation (ClassName .get ("lombok" , "Getter" ))
98102 .build ())
@@ -233,7 +237,7 @@ private void generateSingletonProxy(String proxyBaseClass, Class<? extends Acces
233237 .build ();
234238 javaFile .writeTo (filer );
235239
236- accessorProxyMappings .addStatement ("$T.add(\" singleton\" , $T.class, $T.class)" , ClassName . get ( "com.mx.path.gateway.configuration" , " AccessorProxyMap" ), accessorClass , ClassName .get (packageName , proxyBaseClass + "Singleton" ));
240+ accessorProxyMappings .addStatement ("$T.add(\" singleton\" , $T.class, $T.class)" , ClassHelper . buildClassName ( AccessorProxyMap . class ), accessorClass , ClassName .get (packageName , proxyBaseClass + "Singleton" ));
237241 }
238242
239243 private void generatePrototypeProxy (String proxyBaseClass , Class <? extends Accessor > accessorClass ) throws IOException {
@@ -270,7 +274,7 @@ private void generatePrototypeProxy(String proxyBaseClass, Class<? extends Acces
270274 .build ();
271275 javaFile .writeTo (filer );
272276
273- accessorProxyMappings .addStatement ("$T.add(\" prototype\" , $T.class, $T.class)" , ClassName . get ( "com.mx.path.gateway.configuration" , " AccessorProxyMap" ), accessorClass , ClassName .get (packageName , proxyBaseClass + "Prototype" ));
277+ accessorProxyMappings .addStatement ("$T.add(\" prototype\" , $T.class, $T.class)" , ClassHelper . buildClassName ( AccessorProxyMap . class ), accessorClass , ClassName .get (packageName , proxyBaseClass + "Prototype" ));
274278 }
275279
276280 private String calculatePackageName (Class <? extends Accessor > accessorClass ) {
0 commit comments