io.github.linpeilie.BaseMapper Maven / Gradle / Ivy
The newest version!
package io.github.linpeilie;
import io.github.linpeilie.utils.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import org.mapstruct.MappingTarget;
public interface BaseMapper {
T convert(S source);
T convert(S source, @MappingTarget T target);
default List convert(List sourceList) {
if (CollectionUtils.isEmpty(sourceList)) {
return new ArrayList<>();
}
return sourceList.stream().map(this::convert).collect(Collectors.toList());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy