
org.xson.common.validate.rule.IntegerIntervalChecker Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xco-validate Show documentation
Show all versions of xco-validate Show documentation
xco-validate based XCO, using xml language to describe data validation framework.
The newest version!
package org.xson.common.validate.rule;
import org.xson.common.object.XCO;
import org.xson.common.validate.Checker;
/**
* int型区间值校验
*/
public class IntegerIntervalChecker implements Checker {
@Override
public boolean check(XCO xco, String fieldName, Object value) {
int val = xco.getIntegerValue(fieldName);
int[] result = (int[]) value;
return val >= result[0] && val <= result[1];
}
public static Object parseValue(String value) {
String[] array = value.split(",");
int[] result = { 0, 0 };
result[0] = Integer.parseInt(array[0].trim());
result[1] = Integer.parseInt(array[1].trim());
return result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy