Fix sonar findings on 21 style (#3020)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -255,9 +255,8 @@ public final class TargetView extends TableView<TargetView.TargetWithDs, String>
|
||||
}
|
||||
|
||||
private static List<MgmtTargetFilterQuery> listFilters(HawkbitMgmtClient hawkbitClient) {
|
||||
return Optional.ofNullable(hawkbitClient.getTargetFilterQueryRestApi()
|
||||
.getFilters(null, 0, 30, null, null).getBody())
|
||||
.map(PagedList<MgmtTargetFilterQuery>::getContent)
|
||||
return Optional.ofNullable(hawkbitClient.getTargetFilterQueryRestApi().getFilters(null, 0, 30, null, null).getBody())
|
||||
.map(PagedList::getContent)
|
||||
.orElseGet(List::of);
|
||||
}
|
||||
|
||||
|
||||
@@ -149,18 +149,18 @@ public final class Filter extends Div {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (value instanceof Collection<?> coll) {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
coll.stream().forEach(next -> sb.append(key).append("==").append(next).append(','));
|
||||
return sb.substring(0, sb.length() - 1);
|
||||
} else if (value instanceof Optional<?> opt) {
|
||||
if (opt.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
return key + "==" + opt.get();
|
||||
switch (value) {
|
||||
case Collection<?> coll -> {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
coll.stream().forEach(next -> sb.append(key).append("==").append(next).append(','));
|
||||
return sb.substring(0, sb.length() - 1);
|
||||
}
|
||||
case Optional<?> opt -> {
|
||||
return opt.map(o -> key + "==" + o).orElse(null);
|
||||
}
|
||||
default -> {
|
||||
return key + "==" + value;
|
||||
}
|
||||
} else {
|
||||
return key + "==" + value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user