CustomerQueryMapperImpl.java

package com.github.jenkaby.bikerental.customer.web.query.mapper;

import com.github.jenkaby.bikerental.customer.CustomerInfo;
import com.github.jenkaby.bikerental.customer.web.query.dto.CustomerSearchResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import javax.annotation.processing.Generated;
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 CustomerQueryMapperImpl implements CustomerQueryMapper {

    @Override
    public CustomerSearchResponse toSearchResponse(CustomerInfo customerInfo) {
        if ( customerInfo == null ) {
            return null;
        }

        UUID id = null;
        String phone = null;
        String firstName = null;
        String lastName = null;

        id = customerInfo.id();
        phone = customerInfo.phone();
        firstName = customerInfo.firstName();
        lastName = customerInfo.lastName();

        CustomerSearchResponse customerSearchResponse = new CustomerSearchResponse( id, phone, firstName, lastName );

        return customerSearchResponse;
    }

    @Override
    public List<CustomerSearchResponse> toSearchResponses(List<CustomerInfo> customers) {
        if ( customers == null ) {
            return null;
        }

        List<CustomerSearchResponse> list = new ArrayList<CustomerSearchResponse>( customers.size() );
        for ( CustomerInfo customerInfo : customers ) {
            list.add( toSearchResponse( customerInfo ) );
        }

        return list;
    }
}