RentalEquipmentWebMapperImpl.java
package com.github.jenkaby.bikerental.rental.web.query.mapper;
import com.github.jenkaby.bikerental.rental.domain.model.RentalEquipment;
import com.github.jenkaby.bikerental.rental.shared.mapper.RentalEquipmentStatusMapper;
import com.github.jenkaby.bikerental.rental.web.query.dto.EquipmentItemResponse;
import com.github.jenkaby.bikerental.shared.mapper.MoneyMapper;
import java.math.BigDecimal;
import javax.annotation.processing.Generated;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
comments = "version: 1.6.3, compiler: IncrementalProcessingEnvironment from gradle-language-java-9.4.1.jar, environment: Java 21.0.10 (Amazon.com Inc.)"
)
@Component
public class RentalEquipmentWebMapperImpl implements RentalEquipmentWebMapper {
private final MoneyMapper moneyMapper;
private final RentalEquipmentStatusMapper rentalEquipmentStatusMapper;
@Autowired
public RentalEquipmentWebMapperImpl(MoneyMapper moneyMapper, RentalEquipmentStatusMapper rentalEquipmentStatusMapper) {
this.moneyMapper = moneyMapper;
this.rentalEquipmentStatusMapper = rentalEquipmentStatusMapper;
}
@Override
public EquipmentItemResponse toEquipmentItemResponse(RentalEquipment equipment) {
if ( equipment == null ) {
return null;
}
Long equipmentId = null;
String equipmentUid = null;
BigDecimal estimatedCost = null;
BigDecimal finalCost = null;
Long tariffId = null;
String status = null;
equipmentId = equipment.getEquipmentId();
equipmentUid = equipment.getEquipmentUid();
estimatedCost = moneyMapper.toBigDecimal( equipment.getEstimatedCost() );
finalCost = moneyMapper.toBigDecimal( equipment.getFinalCost() );
tariffId = equipment.getTariffId();
status = rentalEquipmentStatusMapper.statusToString( equipment.getStatus() );
EquipmentItemResponse equipmentItemResponse = new EquipmentItemResponse( equipmentId, equipmentUid, estimatedCost, finalCost, tariffId, status );
return equipmentItemResponse;
}
}