Questions tagged [mapstruct]

MapStruct is a code generator for creating efficient, type-safe bean-to-bean mappings in Java.

MapStruct generates bean mapping code at compile time by means of a JSR 269 annotation processor.
The generated code is fast (no reflection or byte code generation at runtime), type-safe (code is generated from typed, domain-specific interfaces) and dependency-free.

Source Code

1447 questions
-1
votes
1 answer

Mapstruct / to / Mapping

We want to map abstract Person PersonRole1 extends Person PersonRole2 extends Person to abstract PersonDto PersonDtoRoleX extends PersonDto PersonDtoRoleY extends PersonDto PersonDtoRoleZ extends PersonDto The mapper would get…
Alexander Mihailov
  • 1,050
  • 1
  • 12
  • 19
-1
votes
2 answers

get an Entity from a mapper with several Entities

Suppose you have two entities defining objects in a database Ent1 and Ent2 and a DTO describing two in one. My Mapper with MapStruct EntitiesDtoMapper looks like : @Mapper interface EntitiesDtoMapper{ DTO EntitiesToDto(Ent1 ent1, Ent2 ent2); …
Ehcnalb
  • 466
  • 4
  • 16
-1
votes
1 answer

Issue with Mapstruct auto generated Mapper implementations

I am using Mapstruct for DTO to Entity and Vice Versa conversions. Everything is working fine, application is also running. But I don't know what's wrong with eclipse. After running mvn clean install I got a Mapper Implementation class in…
Balwinder Singh
  • 157
  • 1
  • 1
  • 8
-1
votes
1 answer

Mapstruct transform obect to list

I have to map an object to list of another objects like below public List map(ClassA A){ List list = new ArrayList(); ClassB C1 = new ClassB(); ClassB C2= new ClassB(); .... Logic to populate C1 and C2 from ClassA add C1 and C2…
Anil Bhaskaran
  • 495
  • 1
  • 8
  • 23
-2
votes
1 answer

Mapstruct: Only attributes in target Obect are mapped?

So I have a source Object Obj1 and a target Object Obj2. I created a mapper interface Object1Mapper which maps from Obj1 to Obj2. However, no errors show up and I don't understand why. @Data @Entity @Table(name="test") @NoArgsConstructor public…
insomnius
  • 3
  • 2
-2
votes
1 answer

Enum lookup by positioned values using MapStruct

I have implemented my basic requirements, which work well in one simple scenario as mentioned below code snippet. But for new requirements what is the best way out there I need help. New requirement: Statuses in numeric format are used on other…
ravibeli
  • 484
  • 9
  • 30
-3
votes
1 answer

String value to enum mapping when string neither matches enum value nor name

I'm trying to map from a String value to an enum that does not match that string value directly (i.e. String value is "I" and I want to map that to enum value Industry.CREATOR) I'm not seeing anything in mapstruct to do something like this. I'd like…
Alex Trautman
  • 46
  • 1
  • 8
1 2 3
96
97