← ClaudeAtlas

mapperlisted

Scaffold a manual `object` mapper between a domain model and JPA entity. This project maps by hand, not MapStruct, because entities are immutable. Use when adding model-to-entity or entity-to-model conversion.
ch4570/vulpora · ★ 1 · AI & Automation · score 67
Install: claude install-skill ch4570/vulpora
# mapper — manual object mapper Generate a hand-written `object` mapper between a domain **model** and its **entity**. This project maps **by hand**, not with MapStruct, because entities/models are immutable (`val`). This skill encodes that decision so new mappers don't reintroduce MapStruct by accident. > **Authority**: project conventions (e.g. `AGENTS.md`) are binding. Review with `kotlin-spring-review`. ## Where it goes - Domain module (`<domain-module>`), package `com.example.<domain>.mapper`. No `public` keyword. - `object <Name>Mapper` — a stateless singleton, **not** a Spring bean (callers reference it statically). ## Skeleton (see `order/mapper/OrderMapper.kt`, `member/mapper/MemberMapper.kt`) ```kotlin object <Name>Mapper { fun toModel(entity: <Name>Entity): <Name> = <Name>( id = entity.id, status = entity.status, // ...one line per field ) fun toEntity(model: <Name>): <Name>Entity = <Name>Entity( id = model.id, status = model.status, // ... ) fun toModels(entities: List<<Name>Entity>): List<<Name>> = entities.map(::toModel) } ``` ## Rules (MUST) - Hand-written `object`. Map via **constructor** (entities/models are immutable `val`, so MapStruct setter injection cannot work). Do **not** add `@Mapper` / `org.mapstruct.*`. - Convert enum↔String only where the stored representation differs from the model representation; preserve unknown-enum fallbac