All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.linpeilie.BaseMapper Maven / Gradle / Ivy

There is a newer version: 1.4.4
Show 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 - 2024 Weber Informatics LLC | Privacy Policy