本文整理汇总了Java中com.taobao.tddl.common.utils.convertor.ConvertorHelper类的典型用法代码示例。如果您正苦于以下问题:Java ConvertorHelper类的具体用法?Java ConvertorHelper怎么用?Java ConvertorHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ConvertorHelper类属于com.taobao.tddl.common.utils.convertor包,在下文中一共展示了ConvertorHelper类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: longValue
import com.taobao.tddl.common.utils.convertor.ConvertorHelper; //导入依赖的package包/类
public static Long longValue(Object o) {
if (o == null) {
return null;
}
try {
return (Long) commonConvertor.convert(o, Long.class);
} catch (ConvertorException e) {
Convertor convertor = ConvertorHelper.getInstance().getConvertor(o.getClass(), Long.class);
if (convertor != null) {
return (Long) convertor.convert(o, Long.class);
} else {
throw new ConvertorException("Unsupported convert: [" + o.getClass().getName() + ","
+ Long.class.getName() + "]");
}
}
}
示例2: getConvertor
import com.taobao.tddl.common.utils.convertor.ConvertorHelper; //导入依赖的package包/类
/**
* 获取convertor接口
*/
protected Convertor getConvertor(Class clazz) {
if (clazz.equals(getDataClass())) {
return null;
}
Convertor convertor = ConvertorHelper.getInstance().getConvertor(clazz, getDataClass());
if (convertor == null) {
throw new ConvertorException("Unsupported convert: [" + clazz.getName() + "," + getDataClass().getName()
+ "]");
} else {
return convertor;
}
}
示例3: CommonType
import com.taobao.tddl.common.utils.convertor.ConvertorHelper; //导入依赖的package包/类
public CommonType(){
convertor = ConvertorHelper.commonToCommon;
stringConvertor = ConvertorHelper.stringToCommon;
}
示例4: BigBitType
import com.taobao.tddl.common.utils.convertor.ConvertorHelper; //导入依赖的package包/类
public BigBitType(){
super();
convertor = ConvertorHelper.bitBytesToBigDecimal;
}