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

cn.featherfly.conversion.parse.ClassParser Maven / Gradle / Ivy

There is a newer version: 1.5.0
Show newest version

package cn.featherfly.conversion.parse;

import cn.featherfly.common.lang.GenericType;
import cn.featherfly.common.lang.LangUtils;
import cn.featherfly.common.lang.StringUtils;

/**
 * 

* class类协议解析器 *

* * @param 解析的目标类型描述 * @author 钟冀 */ public class ClassParser> extends AbstractIterableParser { /** * 协议字符串常量 */ public static final String PROTOCOL = "class"; /** */ public ClassParser() { } /** * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected T doParseContent(String content, G to) { if (LangUtils.isEmpty(content)) { return null; } try { return (T) Class.forName(StringUtils.trim(content)).newInstance(); } catch (Exception e) { throw new ParseException(e); } } /** * {@inheritDoc} */ @Override protected boolean supportFor(GenericType to) { return true; } /** * {@inheritDoc} */ @Override public String getProtocol() { return PROTOCOL; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy