com.xiaoleilu.hutool.convert.impl.ClassConverter Maven / Gradle / Ivy
package com.xiaoleilu.hutool.convert.impl;
import com.xiaoleilu.hutool.convert.AbstractConverter;
import com.xiaoleilu.hutool.util.ClassUtil;
/**
* 类转换器
* 将类名转换为类
* @author Looly
*
*/
public class ClassConverter extends AbstractConverter>{
@Override
protected Class> convertInternal(Object value) {
String valueStr = convertToStr(value);
try {
return ClassUtil.getClassLoader().loadClass(valueStr);
} catch (Exception e) {
// Ignore Exception
}
return null;
}
}