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

gu.sql2java.utils.EnumTransformer Maven / Gradle / Ivy

There is a newer version: 5.3.2
Show newest version
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