lmccay4 commented on a change in pull request #151: KNOX-2018 - KnoxShellTable
Filtering needs greaterThan and lessThan, equals methods
URL: https://github.com/apache/knox/pull/151#discussion_r327383898
##########
File path:
gateway-shell/src/main/java/org/apache/knox/gateway/shell/KnoxShellTable.java
##########
@@ -654,5 +655,146 @@ public KnoxShellTable regex(String regex) {
}
return table;
}
+
+ public KnoxShellTable filter(Predicate p) {
+ KnoxShellTable table = new KnoxShellTable();
+ table.headers.addAll(headers);
+ for (List<String> row : rows) {
+ if (p.test(row.get(index))) {
+ table.row();
+ row.forEach(value -> {
+ table.value(value);
+ });
+ }
+ }
+ return table;
+ }
+
+ public KnoxShellTable greaterThan(String comparator) {
Review comment:
I don't think this can be done due to the type-specific conversion occurring
in each predicate, where the data point from the table is of type String being
converted into the method-specific argument type. I might be missing something
here, let me know if I am.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services