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

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

There is a newer version: 1.5.0
Show newest version

package cn.featherfly.conversion.parse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import cn.featherfly.common.lang.GenericType;

/**
 * 

* AbstractParser *

* @param 解析后的目标类型描述信息 * @author 钟冀 */ public abstract class AbstractParser> implements Parser{ /** * 日志 */ protected final Logger logger = LoggerFactory.getLogger(this.getClass()); /** *

* 是否提供对传入类型的支持 *

* @param to to * @return 是否支持 */ protected abstract boolean supportFor(GenericType to); /** *

* 解析传入的字符串 *

* @param 返回类型 * @param content 需要解析的内容 * @param to 解析的目标类型描述信息 * @return 解析后的对象 */ protected abstract T doParse(String content, G to); /** * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public , T> T parse(String content, TO to) { if (supportFor(to)) { T result = doParse(content, (G) to); return result; } return null; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy