1 | package org.cardanofoundation.explorer.api.mapper; | |
2 | ||
3 | import java.sql.Timestamp; | |
4 | import java.time.LocalDateTime; | |
5 | ||
6 | import org.mapstruct.Mapper; | |
7 | import org.mapstruct.Mapping; | |
8 | ||
9 | import org.cardanofoundation.explorer.api.model.response.BlockFilterResponse; | |
10 | import org.cardanofoundation.explorer.api.model.response.BlockResponse; | |
11 | import org.cardanofoundation.explorer.common.entity.ledgersync.Block; | |
12 | ||
13 | @Mapper(componentModel = "spring") | |
14 | public interface BlockMapper { | |
15 | ||
16 | @Mapping(target = "slotLeader", source = "slotLeader.hash") | |
17 | BlockResponse blockToBlockResponse(Block block); | |
18 | ||
19 | @Mapping(target = "slotLeader", source = "slotLeader.hash") | |
20 | BlockFilterResponse blockToBlockFilterResponse(Block block); | |
21 | ||
22 | default LocalDateTime fromTimestamp(Timestamp timestamp) { | |
23 |
2
1. fromTimestamp : negated conditional → NO_COVERAGE 2. fromTimestamp : replaced return value with null for org/cardanofoundation/explorer/api/mapper/BlockMapper::fromTimestamp → NO_COVERAGE |
return timestamp == null ? null : timestamp.toLocalDateTime(); |
24 | } | |
25 | } | |
Mutations | ||
23 |
1.1 2.2 |