Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# mapstruct-patterns

Production MapStruct patterns for Kotlin and Java, extracted from a multi-service maritime SaaS platform.
MapStruct patterns for Kotlin and Java: entity-to-DTO mapping, auditing, enums, JSON fields, nested collections.

## What This Repository Is

Expand Down Expand Up @@ -90,16 +90,6 @@ Explicit enum serialization and null-safe collection operations.

## Architecture

```mermaid
graph LR
E[Entity] --> M[Mapper]
M --> D[DTO/Response]
R[Request] --> M
M --> E
P[Policy] --> M
C[Codec] --> M
```

### Boundaries

- **Mappers** handle shape-to-shape transformation only
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ abstract class CIIRecordMapper {
}
}

/**
* Extension function: combines CalculateCIIRequest + CIIComputationResult -> CIICalculationResponse.
* Lives outside the class to keep the mapper uncluttered. Called from the service layer.
*/
fun CIIRecordMapper.toCalculationResponse(
request: CalculateCIIRequest,
result: CIIComputationResult
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,6 @@ import com.mapstructpatterns.model.entity.Organization
import com.mapstructpatterns.model.entity.Subscription

/**
* Organization mapping and response assembly.
*
* This mapper contains both pure shape mappings (toEntity, updateEntity)
* and response assembly methods (toDto, toSummaryDto) that enrich
* responses with additional data like counts and subscription info.
*
* Assembler methods are marked with @JvmStatic-style naming (toDto with extra params)
* to distinguish them from pure MapStruct-generated mappings.
*
* Pattern 7: Manual enrichment + delegated sub-mapper + active subscription lookup
*
* MANUAL toDto():
Expand Down
10 changes: 0 additions & 10 deletions src/main/kotlin/com/mapstructpatterns/mapper/VoyageMapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,6 @@ import java.time.Instant
import java.util.UUID

/**
* Voyage mapping and response assembly.
*
* Pure mappings: toEntity, updateFromRequest
* Assembler methods: toResponse (builds nested statistics),
* toStatisticsResponse (computes derived fields like sailingHours)
*
* Statistics computation is kept here because it's tightly coupled
* to the response shape, but could be extracted to a dedicated
* VoyageStatisticsAssembler if complexity grows.
*
* Pattern 5: Abstract class mapper with manual response mapping and explicit server-side defaults
*
* WHEN TO USE MANUAL MAPPING:
Expand Down
Loading