| | |
| | | * @param message |
| | | */ |
| | | public static void isOne(List<?> targetList, String message) { |
| | | Assert.isNull(targetList, message); |
| | | Assert.notNull(targetList, message); |
| | | |
| | | if (targetList.size() != 1) { |
| | | throw new IllegalArgumentException(message); |
| | |
| | | |
| | | /** |
| | | * 检验是否在 infos 中存在 flowComponent 对应组件的key |
| | | * |
| | | * @param infos |
| | | * @param flowComponent |
| | | * @param key |
| | | * @param message |
| | | */ |
| | | public static void hasKeyByFlowData(JSONArray infos, String flowComponent, String key, String message){ |
| | | public static void hasKeyByFlowData(JSONArray infos, String flowComponent, String key, String message) { |
| | | |
| | | for(int infoIndex = 0 ; infoIndex < infos.size() ; infoIndex ++){ |
| | | for (int infoIndex = 0; infoIndex < infos.size(); infoIndex++) { |
| | | JSONObject _info = infos.getJSONObject(infoIndex); |
| | | if(_info.containsKey(flowComponent) && _info.getString("flowComponent").equals(flowComponent)){ |
| | | if (_info.containsKey(flowComponent) && _info.getString("flowComponent").equals(flowComponent)) { |
| | | hasKeyAndValue(_info, key, message); |
| | | break; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 检验是否在 infos 中存在 flowComponent 对应组件的key |
| | | * |
| | | * @param key |
| | | * @param message |
| | | */ |
| | | public static void isEmail(JSONObject info, String key, String message) { |
| | | hasKeyAndValue(info, key, message); |
| | | if (!ValidatorUtil.isEmail(info.getString(key))) { |
| | | throw new IllegalArgumentException(message); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |