Completed
Push — dev ( 6fd399...4b590f )
by Konstantin
11:42 queued 03:10
created

SubjectsMapper()   A

Complexity

Conditions 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 5
rs 10
cc 1
1
package easytests.api.v1.mappers;
2
3
import easytests.api.v1.models.Subject;
4
import easytests.core.models.SubjectModel;
5
import org.modelmapper.ModelMapper;
6
import org.springframework.stereotype.Service;
7
8
9
/**
10
 * @author VeronikaRevjakina
11
 */
12
@Service("SubjectsMapperV1")
13
public class SubjectsMapper extends ModelMapper {
14
    public SubjectsMapper() {
15
        super();
16
        this.createTypeMap(SubjectModel.class, Subject.class)
17
            .addMappings(mapper -> mapper.<Integer>map(subjectModel -> subjectModel.getUser().getId(),
18
                (subject, id) -> subject.getUser().setId(id)));
19
    }
20
21
}
22