io.github.util.autochecker.AutoChecker Maven / Gradle / Ivy
The newest version!
package io.github.util.autochecker;
import io.github.util.regex.RegexPool;
import io.github.util.regex.RegexUtils;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
* 自动检查器
*/
@Component
public class AutoChecker {
//检查参数是否符合要求,传入类型和Checker接口
public static boolean check(Map> params){
for (Map.Entry> entry : params.entrySet()) {
if (!entry.getValue().goCheck(entry.getKey())) {
return false;
}
}
return true;
}
//检查参数是否符合要求,传入类型和正则表达式
public static boolean checkByRegex(Map params){
for (Map.Entry entry : params.entrySet()) {
if (!RegexUtils.VerifyRegex(entry.getKey(),entry.getValue())) {
return false;
}
}
return true;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy