gu.sql2java.utils.EnumTransformer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sql2java-base Show documentation
Show all versions of sql2java-base Show documentation
sql2java common class package
package gu.sql2java.utils;
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.Function;
/**
* 枚举类型转换
* @author guyadong
*
* @param
* @param
* @since 3.21.0
*/
public class EnumTransformer,R extends Enum> implements Function{
private final Class right;
public EnumTransformer(Class left, Class right) {
checkNotNull(left,"left is null");
this.right = checkNotNull(right,"right is null");
}
@Override
public R apply(L input) {
return null == input ? null : Enum.valueOf(right, input.name());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy