top.cutexingluo.tools.basepackage.function.Converter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xingtools-core Show documentation
Show all versions of xingtools-core Show documentation
xingtools 核心,包括各种接口,实体类和工具类
package top.cutexingluo.tools.basepackage.function;
import org.jetbrains.annotations.Nullable;
import java.util.Objects;
/**
* Converter interface for converting one object to another.
* from org.springframework.core.convert.converter
*
* @author XingTian
* @version 1.0.0
* @date 2024/7/24 17:33
* @since 1.1.2
*/
@FunctionalInterface
public interface Converter {
@Nullable
T convert(S source);
default Converter andThen(Converter super T, ? extends U> after) {
Objects.requireNonNull(after, "After Converter must not be null");
return (s) -> {
T initialResult = this.convert(s);
return initialResult != null ? after.convert(initialResult) : null;
};
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy