Code refactors

- Refactor LauncherFactory.LauncherProvider to LauncherFactory
- Refactor all launcher related components to launcher package
- some basic code cleanup
- Rename all, allSafe -> getList and first, firstSafe -> getString
- Rename Utils -> LegacyUtils

Signed-off-by: solonovamax <solonovamax@12oclockpoint.com>
This commit is contained in:
solonovamax
2022-10-27 19:52:09 -04:00
committed by TheKodeToad
parent 9062d28704
commit 107fa6b4f7
11 changed files with 227 additions and 171 deletions

View File

@ -39,39 +39,39 @@ public final class Parameters {
params.add(value);
}
public List<String> all(String key) throws ParameterNotFoundException {
public List<String> getList(String key) throws ParameterNotFoundException {
List<String> params = map.get(key);
if (params == null)
throw new ParameterNotFoundException(key);
return params;
}
public List<String> allSafe(String key, List<String> def) {
public List<String> getList(String key, List<String> def) {
List<String> params = map.get(key);
if (params == null || params.isEmpty())
return def;
return params;
}
public String first(String key) throws ParameterNotFoundException {
List<String> list = all(key);
public String getString(String key) throws ParameterNotFoundException {
List<String> list = getList(key);
if (list.isEmpty())
throw new ParameterNotFoundException(key);
return list.get(0);
}
public String firstSafe(String key, String def) {
public String getString(String key, String def) {
List<String> params = map.get(key);
if (params == null || params.isEmpty())
return def;
return params.get(0);
}