📄 validationhelper.java
字号:
package com.ebusiness.ebank.util;/** * <p>Title: </p> * <p>Description: This is a helper class for deeply validating the values users entered</p> * * <p>Copyright: Copyright (c) 2005</p> * * <p>Company: eBusiness Inc., All right reserved</p> * * @author unascribed * * @version 1.0 */import java.util.Map;import java.util.List;import java.util.Collections;public class ValidationHelper{ private List countryCodes; private Map stateProvCodeMap; private static ValidationHelper instance; static { instance = new ValidationHelper(); } private ValidationHelper() { //initialize the Map and List StaticDBData dbData = StaticDBData.getInstance(); countryCodes = dbData.getCountryCodes(); stateProvCodeMap = dbData.getStateProvCodeMap(); } public static ValidationHelper getInstance() { return instance; } //Verify if the specified state/province is a valid state/province for the specified country public boolean isStateProvValid(String country, String stateProv) { return Collections.binarySearch((List)stateProvCodeMap.get(country), stateProv) < 0 ? false : true; } //Verify if the specified country is a valid country public boolean isCountryValid(String country) { return Collections.binarySearch(countryCodes, country) < 0 ? false : true; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -