Completed
Push — dev ( 4b590f...6010cc )
by Konstantin
07:35 queued 01:23
created

easytests.api.v1.mappers.TopicsMapper   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 7
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 1
c 2
b 0
f 0
dl 0
loc 7
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A TopicsMapper() 0 5 1
1
package easytests.api.v1.mappers;
2
3
import easytests.api.v1.models.Topic;
4
import easytests.core.models.TopicModel;
5
import org.modelmapper.ModelMapper;
6
import org.springframework.stereotype.Service;
7
8
/**
9
 * @author lelay
10
 */
11
@Service("TopicsMapperV1")
12
public class TopicsMapper extends ModelMapper {
13
    public TopicsMapper() {
14
        super();
15
        this.createTypeMap(TopicModel.class, Topic.class)
16
            .addMappings(mapper -> mapper.<Integer>map(topicModel -> topicModel.getSubject().getId(),
17
                (topic, id) -> topic.getSubject().setId(id)));
18
    }
19
}
20