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

com.dexcoder.commons.bean.LongIntegerConverter Maven / Gradle / Ivy

The newest version!
package com.dexcoder.commons.bean;

/**
 * Created by liyd on 16/4/27.
 */
public class LongIntegerConverter extends AbstractTypeConverter {

    public LongIntegerConverter(Class sourceClass, Class targetClass) {
        super(sourceClass, targetClass);
    }

    @Override
    public Object convert(Class actualSourceClass, Class actualTargetClass, Object value) {
        if (value == null) {
            return null;
        }

        if (actualTargetClass.equals(Long.class)) {
            return Long.valueOf((Integer) value);
        } else {
            return ((Long) value).intValue();
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy