# jtama/openrewrite-refactoring-as-code architecture

> Architecture diagram of the GitHub repository jtama/openrewrite-refactoring-as-code, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jtama/openrewrite-refactoring-as-code
- Repository: https://github.com/jtama/openrewrite-refactoring-as-code

## Overview

Main Components to Include:

##### Project Structure (Three Main Modules)
- toxic-library (Source)
- toxic-library-user (Target)
- toxic-library-remover (Transformation Rules)

##### OpenRewrite Integration Layer
- Recipe Components
- Transformation Rules
- META-INF/rewrite Configuration

**┌─────────────────┐**
- Toxic Library  │ (Source Code to be Transformed)
- ┘
- ↓
**┌─────────────────┐**
- Transformation  │ (OpenRewrite Recipes)
- Engine       │
- ┘
- ↓
**┌─────────────────┐**
- Target Library  │ (Transformed Code)
- ┘

##### Detailed Component Breakdown

a) Toxic Library (Source):
- FooBarUtils and BigDecimalUtils classes

b) Transformation Engine (toxic-library-remover):
- Central component with multiple internal modules
- RemoveFooBarUtilsIsEmpty
- RemoveFooBarUtilsStringFormatted
- RemoveLogStartInvocations
- UseObjectsCompare
- Configuration flow from rewrite.yml

c) Target Application (toxic-library-user):
- Transformed application structure
- Main components:
- Hostels
- Rockets
- Security
- Exceptions

##### Process Flow Indicators

- Validation/test feedback loops

##### Metadata Section

A small section showing:
- Project version
- OpenRewrite version
- Build tool information

Remember to include:
- Clear boundaries between modules
- Recipe discovery and application flow
- Test validation feedback loops
- Configuration management
- Build tool integration points

This will give other engineers a clear understanding of both the high-level architecture and the detailed transformation process.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Style Definitions
    classDef toxic fill:#ffcccc,stroke:#ff0000
    classDef transform fill:#cce5ff,stroke:#0066cc
    classDef target fill:#ccffcc,stroke:#006600
    classDef config fill:#e6e6e6,stroke:#666666
    classDef test fill:#fff2cc,stroke:#ffcc00

    %% Source Code Section
    subgraph Source["Source Code (Toxic Library)"]
        ToxicLib["Toxic Library Source"]
        FooBarUtils["FooBarUtils.java"]
        BigDecimalUtils["BigDecimalUtils.java"]
    end
    
    %% Transformation Engine Section
    subgraph Transform["Transformation Engine"]
        Recipe1["RemoveFooBarUtilsIsEmpty"]
        Recipe2["RemoveFooBarUtilsStringFormatted"]
        Recipe3["RemoveLogStartInvocations"]
        Recipe4["UseObjectsCompare"]
        Config["rewrite.yml"]
    end

    %% Test Section
    subgraph Tests["Validation Tests"]
        Test1["RemoveFooBarCompareTest"]
        Test2["RemoveFooBarIsEmptyTest"]
        Test3["RemoveFooBarUtilsStringFormattedTest"]
        Test4["RemoveLogStartInvocationTest"]
    end

    %% Target Application Section
    subgraph Target["Target Application"]
        Hostels["Hostels Module"]
        Rockets["Rockets Module"]
        Security["Security Module"]
        Exceptions["Exceptions Module"]
    end

    %% Relationships
    Source --> Transform
    Transform --> Target
    Transform --> Tests
    Tests -.-> Transform
    Config --> Recipe1
    Config --> Recipe2
    Config --> Recipe3
    Config --> Recipe4

    %% Click Events
    click ToxicLib "https://github.com/jtama/openrewrite-refactoring-as-code/tree/main/toxic-library/src/main/java/com/github/jtama/toxic/"
    click FooBarUtils "https://github.com/jtama/openrewrite-refactoring-as-code/blob/main/toxic-library/src/main/java/com/github/jtama/toxic/FooBarUtils.java"
    click BigDecimalUtils "https://github.com/jtama/openrewrite-refactoring-as-code/blob/main/toxic-library/src/main/java/com/github/jtama/toxic/BigDecimalUtils.java"
    
    click Recipe1 "https://github.com/jtama/openrewrite-refactoring-as-code/blob/main/toxic-library-remover/src/main/java/com/github/jtama/openrewrite/RemoveFooBarUtilsIsEmpty.java"
    click Recipe2 "https://github.com/jtama/openrewrite-refactoring-as-code/blob/main/toxic-library-remover/src/main/java/com/github/jtama/openrewrite/RemoveFooBarUtilsStringFormatted.java"
    click Recipe3 "https://github.com/jtama/openrewrite-refactoring-as-code/blob/main/toxic-library-remover/src/main/java/com/github/jtama/openrewrite/RemoveLogStartInvocations.java"
    click Recipe4 "https://github.com/jtama/openrewrite-refactoring-as-code/blob/main/toxic-library-remover/src/main/java/com/github/jtama/openrewrite/UseObjectsCompare.java"
    
    click Config "https://github.com/jtama/openrewrite-refactoring-as-code/blob/main/toxic-library-remover/src/main/resources/META-INF/rewrite/rewrite.yml"
    
    click Hostels "https://github.com/jtama/openrewrite-refactoring-as-code/tree/main/toxic-library-user/src/main/java/com/github/jtama/app/hostels/"
    click Rockets "https://github.com/jtama/openrewrite-refactoring-as-code/tree/main/toxic-library-user/src/main/java/com/github/jtama/app/rocket/"
    click Security "https://github.com/jtama/openrewrite-refactoring-as-code/tree/main/toxic-library-user/src/main/java/com/github/jtama/app/security/"
    click Exceptions "https://github.com/jtama/openrewrite-refactoring-as-code/tree/main/toxic-library-user/src/main/java/com/github/jtama/app/exception/"
    
    click Test1 "https://github.com/jtama/openrewrite-refactoring-as-code/blob/main/toxic-library-remover/src/test/java/com/github/jtama/openrewrite/RemoveFooBarCompareTest.java"
    click Test2 "https://github.com/jtama/openrewrite-refactoring-as-code/blob/main/toxic-library-remover/src/test/java/com/github/jtama/openrewrite/RemoveFooBarIsEmptyTest.java"
    click Test3 "https://github.com/jtama/openrewrite-refactoring-as-code/blob/main/toxic-library-remover/src/test/java/com/github/jtama/openrewrite/RemoveFooBarUtilsStringFormattedTest.java"
    click Test4 "https://github.com/jtama/openrewrite-refactoring-as-code/blob/main/toxic-library-remover/src/test/java/com/github/jtama/openrewrite/RemoveLogStartInvocationTest.java"

    %% Styling
    class ToxicLib,FooBarUtils,BigDecimalUtils toxic
    class Recipe1,Recipe2,Recipe3,Recipe4,Transform transform
    class Hostels,Rockets,Security,Exceptions target
    class Config config
    class Test1,Test2,Test3,Test4 test
```
