Class ControllerScanner

java.lang.Object
com.arc_e_tect.gradle.shadow.scan.ControllerScanner

public class ControllerScanner extends Object
Parses Java source files and collects every HTTP endpoint exposed by a Spring @RestController class.

Recognises the class-level @RequestMapping base path plus the standard method-level mapping annotations: @RequestMapping, @GetMapping, @PostMapping, @PutMapping, @DeleteMapping, and @PatchMapping. When a @RequestMapping method annotation does not restrict its method attribute, the resulting Endpoint carries HttpVerb.ANY.

Annotations are matched by simple name, so both the standard org.springframework.web.bind.annotation imports and any fully-qualified usage are recognised without requiring Spring on the scanner's own classpath.

  • Constructor Details

    • ControllerScanner

      public ControllerScanner()
      Creates a new ControllerScanner.
  • Method Details

    • scan

      public List<Endpoint> scan(File sourceFile) throws IOException
      Scans one .java source file and returns every endpoint exposed by every @RestController class it declares.
      Parameters:
      sourceFile - the file to parse
      Returns:
      possibly-empty list of endpoints, never null
      Throws:
      IOException - if the file cannot be read