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

com.xiaoleilu.hutool.convert.impl.EnumConverter Maven / Gradle / Ivy

The newest version!
package com.xiaoleilu.hutool.convert.impl;

import com.xiaoleilu.hutool.convert.AbstractConverter;

/**
 * 枚举转换器
 * 
 * @param  枚举类类型
 * @author Looly
 * @since 3.2.0
 */
public class EnumConverter> extends AbstractConverter {

	private Class enumClass;
	
	/**
	 * 构造
	 * 
	 * @param enumClass 转换成的目标Enum类
	 */
	public EnumConverter(Class enumClass) {
		this.enumClass = enumClass;
	}

	@Override
	protected E convertInternal(Object value) {
		return Enum.valueOf(enumClass, convertToStr(value));
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy