File tree Expand file tree Collapse file tree
src/main/java/io/openapiprocessor/maven Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212 */
1313class ProcessorLoader {
1414
15+ public static Optional <io .openapiprocessor .api .v2 .OpenApiProcessor > findProcessorV2 (
16+ String processorName , ClassLoader classLoader ) {
17+
18+ List <io .openapiprocessor .api .v2 .OpenApiProcessor > processors = new ArrayList <> ();
19+
20+ ServiceLoader .load (io .openapiprocessor .api .v2 .OpenApiProcessor .class , classLoader )
21+ .forEach (processors ::add );
22+
23+ return processors
24+ .stream ()
25+ .filter (p -> p .getName ().equals (processorName ))
26+ .findFirst ();
27+ }
1528
1629 public static Optional <io .openapiprocessor .api .v1 .OpenApiProcessor > findProcessorV1 (
1730 String processorName , ClassLoader classLoader ) {
Original file line number Diff line number Diff line change @@ -24,6 +24,14 @@ class ProcessorRunner {
2424
2525 void run () {
2626 try {
27+ Optional <io .openapiprocessor .api .v2 .OpenApiProcessor > processorV2 = ProcessorLoader
28+ .findProcessorV2 (processorName , this .getClass ().getClassLoader ());
29+
30+ if (processorV2 .isPresent ()) {
31+ processorV2 .get ().run (processorProps );
32+ return ;
33+ }
34+
2735 Optional <io .openapiprocessor .api .v1 .OpenApiProcessor > processorV1 = ProcessorLoader
2836 .findProcessorV1 (processorName , this .getClass ().getClassLoader ());
2937
You can’t perform that action at this time.
0 commit comments