src/main/java/hexlet/code/mapper/UserMapper.java
package hexlet.code.mapper;
import hexlet.code.dto.UserDTO;
import hexlet.code.model.User;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingConstants;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.ReportingPolicy;
@Mapper(
uses = { JsonNullableMapper.class, ReferenceMapper.class },
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
componentModel = MappingConstants.ComponentModel.SPRING,
unmappedTargetPolicy = ReportingPolicy.IGNORE
)
public abstract class UserMapper {
@Mapping(target = "password", ignore = true)
public abstract UserDTO map(User model);
public abstract User map(UserDTO data);
public abstract void update(UserDTO data, @MappingTarget User model);
}