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

com.lmaye.cloud.starter.canal.utils.StringConvertUtil Maven / Gradle / Ivy

package com.lmaye.cloud.starter.canal.utils;

import com.lmaye.cloud.starter.canal.patterns.IType;
import com.lmaye.cloud.starter.canal.patterns.StrategyFactory;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
 * -- String Convert Util
 *
 * @author Lmay Zhou
 * @date 2021/3/22 11:27
 * @email [email protected]
 */
public class StringConvertUtil {
    static Object convertType(Class type, String columnValue) {
        if (StringUtils.isBlank(columnValue)) {
            return null;
        }
        IType iType = StrategyFactory.getType(type.getTypeName());
        if(Objects.isNull(iType)) {
            return columnValue;
        }
        return iType.convertType(columnValue);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy