Created
December 30, 2020 06:16
-
-
Save sutra/84c31ed063c7d7e31174302e05771fd5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private boolean isValid(String param) { | |
return param != null && (param.equals("0") || param.equals("1")); | |
} | |
private boolean isValid(String... params) { | |
for (String param : params) { | |
if (!isValid(param)) { | |
return false; | |
} | |
} | |
return true; | |
} | |
public void hello(String open, String w1, String w2, String w3, String w4, String w5, String w6, String w7) { | |
if (!isValid(open, w1, w2, w3, w4, w5, w6, w7)) { | |
throw new IllegalArgumentException("设置项目参数非法!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment