mapstruct / mapstruct/mapstruct

Method to get list of mapped properties

Open
#1,960 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
7.7k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

Mapstruct could generate based on the mapping define for one method, another method that for a given path return the target path.

Here is an example
```
class Car {
int seatCount;
}

class CarDto {
int numberOfSeats;
}

@Mapper
class CarMapper {
@Mapping(target="numberOfSeats", source="seatCount")
CarDto toCarDto(Car source);

--> @MappingDescriptor(method="toCarDto")
--> String carDtoProperty(String carPropertyPath);
}
```

Potential use case: When you define a rest api having a different name than the database model, you can use mapstruct to modify your pojo, but for the sort property you still have to change it manually. With this feature it could rely on how your map your pojo to map the sort property.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the MapStruct annotation processor and the example CarMapper.toCarDto mapping; the issue names no source files or tests to inspect. Define how a generated carDtoProperty method should translate source property paths to target paths, including the completion criteria for mapped and unmapped paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.