package com.ssm.util.sms.excel.validation.base;

import com.ssm.util.sms.excel.exception.ValidationException;

import com.ssm.util.sms.excel.validation.Validation;

public class IntegerTypeValidation implements Validation {
	public boolean validate(int rowIndex, Integer[] index, String[] value,
			StringBuffer message) throws ValidationException {
		boolean result = true;
		for (int i = 0; i < value.length; i++) {
			if (value[i].length() != 0) {
				try {
					Integer.parseInt(value[i]);
				} catch (NumberFormatException e) {
					message.append("第" + (rowIndex + 1) + "行第"
							+ (index[i].intValue() + 1) + "列数据类型不合法！");
					result = false;
				}
			}
		}
		return result;
	}
}
