mapstruct Questions

4

I'm trying to create very simple JUnit test into Spring Cloud project: @SpringBootTest(classes = {ProductMapper.class }) public class TestingWebApplicationTests { @Test public void contextLoads(...
Referee asked 12/2, 2021 at 10:50

2

Solved

I'm trying to map some POJOs from Java to Protobuf (proto3). Some of them contain Lists. While mapping lists with POJOs (for example List) is no problem, I'm getting a UnsupportedOperationException...
Quits asked 19/7, 2018 at 7:38

5

Solved

I am using mapstruct to map from one DTO to another. I have multiple default methods , but 2 of them with a return value of String and that uses the same class as the input parameter gives me "Ambi...
Dorcia asked 11/2, 2019 at 3:43

3

Solved

I am using MapStruct to map between JPA entities and POJO DTOs. All my entities extend a common base class that has an ID field (a java.lang.Long). I have the following abstract mapper, that allo...
Vortumnus asked 27/7, 2016 at 10:24

2

Solved

I can find answers where we have String to Enum mapping but I can't find how can I map an Enum to a String. public class Result { Value enumValue; } public enum Value { TEST, NO TEST } public...
Heartwood asked 18/2, 2022 at 17:36

4

Solved

I am trying to map a non-iterable value i.e. String to a list of string using mapstruct. So I am using @Mapping(target = "abc", expression = "java(java.util.Arrays.asList(x.getY().getXyz()))") ...
Giffy asked 1/11, 2017 at 7:52

4

Solved

I'm having the following error when I run the command mvn clean install: [ERROR] /Users/xxx/xxx/xxx/xxx.xxx/target/generated-sources/kapt/compile/com/xxx/xxx/xxx/xxx/DataMapperImpl.java:[10,40] can...
Gherardo asked 17/8, 2021 at 15:0

3

I want to map a list of Objects to an Object that contains a list: public class Group { private List<Person> people; } public class Person { private String name; } I tried creating a ma...
Stark asked 25/3, 2019 at 15:28

7

Solved

I am using Mapstruct and Lombok with maven and IDEA and it is refusing to generate mappers implementation. Config: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apac...
Potman asked 31/1, 2019 at 17:4

6

Solved

After upgrading to the version 2020.3 of Idea i get a NullPointerException for the mapping processor. If anybody has a clue... Thank you!
Lethargic asked 2/12, 2020 at 16:44

5

Solved

I'm trying to customize a mapping use a string to determine an object attribute so I wrote this: @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) public a...
Lingcod asked 8/2, 2022 at 14:5

2

Solved

I have these 3 classes in separate files public class Book { @Id @GeneratedValue private Long id; @NonNull private String title; @NonNull private Author author; } public class Author {...
Campus asked 9/10, 2018 at 13:15

2

Solved

There are several ways to ignore unmapped target properties in mapstruct. We could list all properties to ignore for specific method: @Mapping(target = "propName", ignore = true) Or s...
Newson asked 5/4, 2022 at 6:55

16

Solved

I downloaded application from this source https://github.com/springframeworkguru/spring5-mvc-rest/tree/vendor-api And I have a problem with MapStruct. @Mapper public interface CategoryMapper { Ca...
Latricelatricia asked 4/11, 2017 at 10:40

2

Solved

I have these two classes: public class CustomerEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private long id; private String firstName; private String lastName; private St...
Unicycle asked 9/10, 2019 at 23:3

4

Is it possible to set a value from a field from the application.properties file? I am looking for something like @Mapping(target="version", expression="${application.version}")...
Arne asked 12/11, 2021 at 12:8

3

Solved

I want to map 2 models, where each of them has almost the same enums. Let me show: The first model has enum: public enum EventSource { BETRADAR("SOURCE_BETRADAR"), BETGENIUS("SOURCE_BETGENIUS")...
Vulgarity asked 19/6, 2020 at 14:16

6

Solved

I using MapStruct to map my entities, and I'm mocking my objects using Mockito. I want to test a method that contains a mapping with mapStruct. The problem is the nested mapper is always null in m...
Underpay asked 19/2, 2019 at 20:49

2

Solved

I have as parent class : User.java , and 2 classes : FacebookUser.java and TwitterUser.java they are entities that returned depends on the type column in database using DiscriminatorColumn, I want ...
Rosabella asked 29/9, 2016 at 15:7

3

Solved

MapStruct is unable to create an implementation when I'm trying to map object with a private default constructor, but with a (lombok generated) builder. SomeMapperImpl.java:[20,27] SomeDto() is no...
Dustindustman asked 29/1, 2021 at 13:1

2

I want to map nested java objects. Customer.address.houseNumber to userDTO.homeDTO.addressDTO.houseNo. Expectation: If and only if Customer.address.houseNumber is not null, then create homeDTO obje...
Receiver asked 28/9, 2017 at 13:6

1

Solved

MyOM and MyEntity objects have an id as a field The function map() works. If I set the id parameter, then my MyEntity in map() receives this parameter. I want to do the same thing with mapDTOs(). W...
Athamas asked 15/11, 2022 at 16:12

2

Is it possible to trim a string value before it is set against a bean property of type string in the destination bean? Dozer offers such a facility through its mapping configuration for example, ...
Provincialism asked 1/8, 2016 at 16:2

5

Solved

I have an entity with a property I used to write like this private Long ICU; I'm using mapstruct: Here is my mapper for said entity: @Mapper(componentModel = "spring") public interface Pr...
Dignadignified asked 2/7, 2019 at 9:12

3

I have a hierarchy of classes: VehicleDTO is a base abstract class. CarDTO, TruckDTO, VanDTO extend from it. I have the same hierarchy on the other side of a mapper: VehicleBO <- CarBO, TruckBO,...
Ewing asked 23/6, 2020 at 21:37

© 2022 - 2024 — McMap. All rights reserved.