File tree Expand file tree Collapse file tree 3 files changed +0
-42
lines changed
sample/src/main/java/io/ermdev/mapfierj/sample Expand file tree Collapse file tree 3 files changed +0
-42
lines changed Original file line number Diff line number Diff line change 11package io .ermdev .mapfierj .sample .sample1 ;
22
3- import io .ermdev .mapfierj .ConvertTo ;
4- import io .ermdev .mapfierj .FieldName ;
5-
63public class Person {
74
8- @ FieldName ("fullName" )
95 String name ;
106 int age ;
11-
12- @ FieldName ("car" )
13- @ ConvertTo (value = Car .class , converter = IntegerCarConverter .class )
147 int carId ;
158
169 public Person (String name , int age , int carId ) {
Original file line number Diff line number Diff line change 11package io .ermdev .mapfierj .sample .sample1 ;
22
33import io .ermdev .mapfierj .ModelMapper ;
4- import io .ermdev .mapfierj .SimpleMapper ;
54import org .junit .Test ;
65
76import java .util .logging .Logger ;
@@ -10,19 +9,6 @@ public class Sample1 {
109
1110 Logger logger = Logger .getLogger (Sample1 .class .getSimpleName ());
1211
13- @ Test
14- public void simpleMapper () {
15- int carId = (int ) (Math .random () * 10 ) + 1 ;
16-
17- SimpleMapper mapper = new SimpleMapper ();
18-
19- Person person = new Person ("Rafael" , 18 , carId );
20-
21- PersonDto personDto = mapper .set (person ).mapTo (PersonDto .class );
22-
23- logger .info (personDto .toString ());
24- }
25-
2612 @ Test
2713 public void modelMapper () {
2814 final String PACKAGE_NAME = getClass ().getPackage ().toString ();
Original file line number Diff line number Diff line change 11package io .ermdev .mapfierj .sample .sample2 ;
22
3- import io .ermdev .mapfierj .ModelMapper ;
43import io .ermdev .mapfierj .SimpleMapper ;
54import org .junit .Test ;
65
@@ -22,24 +21,4 @@ public void simpleMapper() {
2221
2322 logger .info (personDto .toString ());
2423 }
25-
26- @ Test
27- public void modelMapper () {
28- final String PACKAGE_NAME = getClass ().getPackage ().toString ();
29- int carId = (int ) (Math .random () * 10 ) + 1 ;
30-
31- ModelMapper mapper = new ModelMapper ();
32- mapper .getConverter ().scanPackages (PACKAGE_NAME );
33-
34- Person person = new Person ("Rafael" , 18 , carId );
35- PersonDto personDto = mapper .set (person )
36- .field ("name" , "fullName" )
37- .field ("carId" , "car" )
38- .convertFieldToType ("car" , Car .class )
39- .getTransaction ().mapTo (PersonDto .class );
40-
41- logger .info ("CAR ID : " + carId );
42- logger .info ("Package : " + PACKAGE_NAME );
43- logger .info (personDto .toString ());
44- }
4524}
You can’t perform that action at this time.
0 commit comments