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:
@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user