# gabhrielv/factorymethod architecture

> Architecture diagram of the GitHub repository gabhrielv/factorymethod, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gabhrielv/factorymethod
- Repository: https://github.com/gabhrielv/factorymethod

## Overview

This small Java example provides a payment strategy interface, three payment implementations, and a reflective factory that selects an implementation from a payment name. The principal workflow is a caller requesting a payment implementation and then using its processing or reversal methods. The repository contains no application entry point or external payment integrations, so the caller is conceptual and the graph does not imply real payment processing.

Main entry points: [`src/main/java/aula2/PagamentoFactory.java`](https://github.com/gabhrielv/factorymethod/blob/main/src/main/java/aula2/PagamentoFactory.java) (Payment Factory), [`src/main/java/aula2/IPagamento.java`](https://github.com/gabhrielv/factorymethod/blob/main/src/main/java/aula2/IPagamento.java) (Payment Contract), [`src/main/java/aula2/PagamentoBoleto.java`](https://github.com/gabhrielv/factorymethod/blob/main/src/main/java/aula2/PagamentoBoleto.java) (Boleto Payment), [`src/main/java/aula2/PagamentoCartao.java`](https://github.com/gabhrielv/factorymethod/blob/main/src/main/java/aula2/PagamentoCartao.java) (Card Payment)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_caller(("Caller"))
node_factory["Payment Factory"]
node_interface["Payment Contract<br/>[IPagamento.java]"]
node_boleto["Boleto Payment"]
node_cartao["Card Payment"]
node_pix["Pix Payment<br/>[PagamentoPix.java]"]

node_caller -->|"requests payment"| node_factory
node_factory -->|"loads by name"| node_boleto
node_factory -->|"loads by name"| node_cartao
node_factory -->|"loads by name"| node_pix
node_factory -->|"returns contract"| node_interface
node_caller -->|"processes or reverses"| node_interface
node_boleto -->|"implements"| node_interface
node_cartao -->|"implements"| node_interface
node_pix -->|"implements"| node_interface

click node_factory "https://github.com/gabhrielv/factorymethod/blob/main/src/main/java/aula2/PagamentoFactory.java"
click node_interface "https://github.com/gabhrielv/factorymethod/blob/main/src/main/java/aula2/IPagamento.java"
click node_boleto "https://github.com/gabhrielv/factorymethod/blob/main/src/main/java/aula2/PagamentoBoleto.java"
click node_cartao "https://github.com/gabhrielv/factorymethod/blob/main/src/main/java/aula2/PagamentoCartao.java"
click node_pix "https://github.com/gabhrielv/factorymethod/blob/main/src/main/java/aula2/PagamentoPix.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_caller toneIndigo
class node_factory,node_interface,node_boleto,node_cartao,node_pix toneTeal
```

## Components

### Other components

- **Caller**
- [Payment Factory](https://github.com/gabhrielv/factorymethod/blob/main/src/main/java/aula2/PagamentoFactory.java): `src/main/java/aula2/PagamentoFactory.java`
- [Payment Contract](https://github.com/gabhrielv/factorymethod/blob/main/src/main/java/aula2/IPagamento.java): `src/main/java/aula2/IPagamento.java`
- [Boleto Payment](https://github.com/gabhrielv/factorymethod/blob/main/src/main/java/aula2/PagamentoBoleto.java): `src/main/java/aula2/PagamentoBoleto.java`
- [Card Payment](https://github.com/gabhrielv/factorymethod/blob/main/src/main/java/aula2/PagamentoCartao.java): `src/main/java/aula2/PagamentoCartao.java`
- [Pix Payment](https://github.com/gabhrielv/factorymethod/blob/main/src/main/java/aula2/PagamentoPix.java): `src/main/java/aula2/PagamentoPix.java`

## Connections

- Caller → Payment Factory: requests payment
- Payment Factory → Boleto Payment: loads by name
- Payment Factory → Card Payment: loads by name
- Payment Factory → Pix Payment: loads by name
- Payment Factory → Payment Contract: returns contract
- Caller → Payment Contract: processes or reverses
- Boleto Payment → Payment Contract: implements
- Card Payment → Payment Contract: implements
- Pix Payment → Payment Contract: implements
