package com.ankurm.beanmapping.mapstruct; import com.ankurm.beanmapping.model.ProfileDTO; import com.ankurm.beanmapping.model.ProfileEntity; import com.ankurm.beanmapping.model.TagEntity; import com.ankurm.beanmapping.model.UserDTO; import com.ankurm.beanmapping.model.UserEntity; import java.util.ArrayList; import java.util.List; import javax.annotation.processing.Generated; @Generated( value = "org.mapstruct.ap.MappingProcessor", date = "2026-12-01T08:07:17+0530", comments = "version: 1.6.3, compiler: javac, environment: Java 25.0.5.1 (Eclipse Adoptium)" ) public class UserMapperImpl implements UserMapper { @Override public UserEntity toEntity(UserDTO dto) { if ( dto == null ) { return null; } UserEntity userEntity = new UserEntity(); userEntity.setEmailAddress( dto.getEmail() ); userEntity.setId( dto.getId() ); userEntity.setUsername( dto.getUsername() ); userEntity.setProfile( toEntity( dto.getProfile() ) ); userEntity.setTags( stringListToTagEntityList( dto.getTags() ) ); return userEntity; } @Override public UserDTO toDto(UserEntity entity) { if ( entity == null ) { return null; } UserDTO userDTO = new UserDTO(); userDTO.setEmail( entity.getEmailAddress() ); userDTO.setId( entity.getId() ); userDTO.setUsername( entity.getUsername() ); userDTO.setProfile( toDto( entity.getProfile() ) ); userDTO.setTags( tagEntityListToStringList( entity.getTags() ) ); return userDTO; } @Override public ProfileEntity toEntity(ProfileDTO profile) { if ( profile == null ) { return null; } ProfileEntity profileEntity = new ProfileEntity(); profileEntity.setFirstName( profile.getFirstName() ); profileEntity.setLastName( profile.getLastName() ); return profileEntity; } @Override public ProfileDTO toDto(ProfileEntity profile) { if ( profile == null ) { return null; } ProfileDTO profileDTO = new ProfileDTO(); profileDTO.setFirstName( profile.getFirstName() ); profileDTO.setLastName( profile.getLastName() ); return profileDTO; } @Override public void update(UserEntity target, UserDTO source) { if ( source == null ) { return; } if ( source.getEmail() != null ) { target.setEmailAddress( source.getEmail() ); } target.setId( source.getId() ); if ( source.getUsername() != null ) { target.setUsername( source.getUsername() ); } if ( source.getProfile() != null ) { target.setProfile( toEntity( source.getProfile() ) ); } if ( target.getTags() != null ) { List list = stringListToTagEntityList( source.getTags() ); if ( list != null ) { target.getTags().clear(); target.getTags().addAll( list ); } } else { List list = stringListToTagEntityList( source.getTags() ); if ( list != null ) { target.setTags( list ); } } } protected List stringListToTagEntityList(List list) { if ( list == null ) { return null; } List list1 = new ArrayList( list.size() ); for ( String string : list ) { list1.add( toTag( string ) ); } return list1; } protected List tagEntityListToStringList(List list) { if ( list == null ) { return null; } List list1 = new ArrayList( list.size() ); for ( TagEntity tagEntity : list ) { list1.add( fromTag( tagEntity ) ); } return list1; } }