class ItemMapper {

    public Object mergeValue(Object newObject, Object oldValue) {
        Object result = newObject;
        if (newObject instanceof Long) {
            Long oldLong = (Long)oldValue;
            Long newLong = (Long)newObject;
            result = (oldLong+newLong);
        } else if (newObject instanceof BigDecimal) {
            BigDecimal oldDecimal = (BigDecimal)oldValue;
            BigDecimal newDecimal = (BigDecimal)newObject;
            result = (oldDecimal.add(newDecimal));
        }
        return result;
    }

}