-
Notifications
You must be signed in to change notification settings - Fork 144
Expand file tree
/
Copy pathItemMapper.java
More file actions
25 lines (22 loc) · 777 Bytes
/
ItemMapper.java
File metadata and controls
25 lines (22 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package ru.practicum.shareit.item;
import ru.practicum.shareit.item.dto.ItemDto;
import ru.practicum.shareit.item.model.Item;
public class ItemMapper {
public static Item toItem(ItemDto dto) {
return Item.builder()
.available(dto.getAvailable())
.description(dto.getDescription())
.name(dto.getName())
.id(dto.getId())
.build();
}
public static ItemDto toItemDto(Item entity) {
return ItemDto.builder()
.requestId(entity.getRequestId())
.available(entity.getAvailable())
.description(entity.getDescription())
.name(entity.getName())
.id(entity.getId())
.build();
}
}