Package: org.apache.groovy.docgenerator

## [Groovy] Class MockSourceGenerator

- org.apache.groovy.docgenerator.MockSourceGenerator

-     class MockSourceGenerator
      extends Object

  Emits Java source files that stand in for the JDK types the Groovy Development Kit enhances, so that `groovydoc` can process them as a normal source tree. Each receiver type in the parsed DGM sources becomes one mock class: instance methods for the typical case, static methods for sources whose class name ends in `StaticMethods` or `StaticExtensions`. Primitive and primitive-array receivers are emitted under legal identifier names in a synthetic package (`primitives`); reference-array receivers are emitted in the receiver's own package with a synthetic class name. The true display name (such as `int[]`) is carried on the class-level javadoc as a `@displayName` tag and read by an override template; a post-process pass renames generated HTML paths back to the historical URLs (e.g. `primitives-and-primitive-arrays/int[].html`).

  Since:
    6.0.0

- - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `static String` | `MANIFEST_FILE` Lines of `fromRelPath\tdisplayPackage\tdisplayName` written alongside the mocks so PrimitiveNameRewriter can rename HTML output back to historical URLs like `primitives-and-primitive-arrays/int[].html`.
    `static String` | `PRIMITIVES_PKG` Synthetic package used for primitive and primitive-array receiver mocks.
    `static List<String>` | `PRIMITIVE_BASES` Primitive base names that require dedicated mock types.

  - ### Constructor Summary

    Constructors
    Constructor and description
    `MockSourceGenerator(List<File> sourceFiles, File outputDir)` Creates a generator for the supplied extension source files.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `static String` | `displayNameFor(String fqcn)` Human-readable label used in displayName: tag: preserves brackets and the simple name only.
    `` | `static String` | `displayPackageFor(String fqcn, com.thoughtworks.qdox.model.JavaType type)` Where the generated HTML page should live after rewriting (historical URL).
    `` | `void` | `generateAll()` Generates mock source files for all supported receiver types.
    `` | `static void` | `main(String[] args)` Runs the mock-source generator from the command line.
    `` | `static String` | `mockClassNameFor(String fqcn, com.thoughtworks.qdox.model.JavaType type)` Legal Java identifier used as the mock class name for a top-level receiver.
    `` | `static String` | `mockPackageFor(String fqcn, com.thoughtworks.qdox.model.JavaType type)` Package the mock file lives in, derived from the receiver's FQCN.
    `` | `static String` | `outerClassFqcn(String fqcn)` If `fqcn` names a nested type (has an uppercase-starting segment that isn't the last), returns the outer type's FQCN.
    `` | `static String` | `resolveJdkClassName(String className)`
    `` | `static String` | `rewriteLinks(String text)` Rewrites `{@link #method(Recv, A, B)`} to `{@link Recv#method(A, B)`} — the first argument becomes the explicit class prefix, matching how DocUtil.linkify operated in the original DocGenerator.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Property Detail

    - #### static final String MANIFEST_FILE

      Lines of `fromRelPath\tdisplayPackage\tdisplayName` written alongside the mocks so PrimitiveNameRewriter can rename HTML output back to historical URLs like `primitives-and-primitive-arrays/int[].html`.

    - #### static final String PRIMITIVES_PKG

      Synthetic package used for primitive and primitive-array receiver mocks.

    - #### static final List<String> PRIMITIVE_BASES

      Primitive base names that require dedicated mock types.

  - ### Constructor Detail

    - #### MockSourceGenerator(List<File> sourceFiles, File outputDir)

      Creates a generator for the supplied extension source files.

      Parameters:
        `sourceFiles` - source files that contribute extension methods
        `outputDir` - directory where mock sources should be written

  - ### Method Detail

    - #### static String displayNameFor(String fqcn)

      Human-readable label used in

      displayName:
        tag: preserves brackets and the simple name only.

    - #### static String displayPackageFor(String fqcn, com.thoughtworks.qdox.model.JavaType type)

      Where the generated HTML page should live after rewriting (historical URL).

    - #### void generateAll()

      Generates mock source files for all supported receiver types.

    - #### static void main(String[] args)

      Runs the mock-source generator from the command line.

      Parameters:
        `args` - command-line arguments

    - #### static String mockClassNameFor(String fqcn, com.thoughtworks.qdox.model.JavaType type)

      Legal Java identifier used as the mock class name for a top-level receiver.

    - #### static String mockPackageFor(String fqcn, com.thoughtworks.qdox.model.JavaType type)

      Package the mock file lives in, derived from the receiver's FQCN.

    - #### static String outerClassFqcn(String fqcn)

      If `fqcn` names a nested type (has an uppercase-starting segment that isn't the last), returns the outer type's FQCN. Otherwise returns null.

    - #### static String resolveJdkClassName(String className)

    - #### static String rewriteLinks(String text)

      Rewrites `{@link #method(Recv, A, B)`} to `{@link Recv#method(A, B)`} — the first argument becomes the explicit class prefix, matching how DocUtil.linkify operated in the original DocGenerator.