BlankDataAccessMapperImpl.java

package com.blanksystem.blank.service.data.mapper;

import com.blanksystem.blank.service.data.entity.BlankEntity;
import com.blanksystem.blank.service.domain.entity.Blank;
import com.blanksystem.blank.service.domain.valueobject.BlankId;
import java.util.UUID;
import javax.annotation.processing.Generated;
import org.springframework.stereotype.Component;

@Generated(
    value = "org.mapstruct.ap.MappingProcessor",
    date = "2024-11-04T20:44:02+0000",
    comments = "version: 1.6.2, compiler: javac, environment: Java 21.0.5 (Azul Systems, Inc.)"
)
@Component
public class BlankDataAccessMapperImpl implements BlankDataAccessMapper {

    @Override
    public Blank blankEntityToBlank(BlankEntity blankEntity) {
        if ( blankEntity == null ) {
            return null;
        }

        BlankId blankId = null;

        Blank blank = new Blank( blankId );

        blank.setId( map( blankEntity.getId() ) );

        return blank;
    }

    @Override
    public BlankEntity blankToBlankEntity(Blank blank) {
        if ( blank == null ) {
            return null;
        }

        BlankEntity.BlankEntityBuilder blankEntity = BlankEntity.builder();

        blankEntity.id( blankIdValue( blank ) );

        return blankEntity.build();
    }

    private UUID blankIdValue(Blank blank) {
        BlankId id = blank.getId();
        if ( id == null ) {
            return null;
        }
        return id.getValue();
    }
}