Skip to content

Commit 526c545

Browse files
committed
Update cloner example to use new mapping control
1 parent f2139a6 commit 526c545

1 file changed

Lines changed: 2 additions & 14 deletions

File tree

  • mapstruct-clone/src/main/java/org/mapstruct/example/mapper

mapstruct-clone/src/main/java/org/mapstruct/example/mapper/Cloner.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,9 @@
1818
*/
1919
package org.mapstruct.example.mapper;
2020

21-
import java.util.List;
22-
import java.util.Map;
23-
2421
import org.mapstruct.Mapper;
22+
import org.mapstruct.control.DeepClone;
2523
import org.mapstruct.example.dto.CustomerDto;
26-
import org.mapstruct.example.dto.OrderItemDto;
27-
import org.mapstruct.example.dto.OrderItemKeyDto;
2824
import org.mapstruct.factory.Mappers;
2925

3026
/**
@@ -33,18 +29,10 @@
3329
* By defining all methods, we force MapStruct to generate new objects for each mapper in stead of
3430
* taking shortcuts by mapping an object directly.
3531
*/
36-
@Mapper
32+
@Mapper(mappingControl = DeepClone.class)
3733
public interface Cloner {
3834

3935
Cloner MAPPER = Mappers.getMapper( Cloner.class );
4036

4137
CustomerDto clone(CustomerDto customerDto);
42-
43-
List<OrderItemDto> clone(List<OrderItemDto> orders);
44-
45-
OrderItemDto clone(OrderItemDto order);
46-
47-
Map<OrderItemKeyDto, OrderItemDto> clone(Map<OrderItemKeyDto, OrderItemDto> stock);
48-
49-
OrderItemKeyDto clone( OrderItemKeyDto orderItemKeyDto );
5038
}

0 commit comments

Comments
 (0)