[bisq-network/bisq] Build out 'createoffer' API method (#4559)
Stan
notifications at github.com
Fri Oct 2 17:43:58 UTC 2020
@ghubstan commented on this pull request.
> +import java.util.Map;
+import java.util.function.Predicate;
+
+import static java.util.Arrays.stream;
+
+class NegativeNumberOptions {
+
+ private final Map<Integer, String> negativeNumberParams = new HashMap<>();
+
+ String[] removeNegativeNumberOptions(String[] args) {
+ // Cache any negative number params that will be rejected by the parser.
+ // This should be called before command line parsing.
+ for (int i = 0; i < args.length; i++) {
+ if (isNegativeNumber.test(args[i])) {
+ String param = args[i];
+ negativeNumberParams.put(i - 1, new BigDecimal(param).toString());
I use `negativeNumberParams.put(i - 1, ...)` because `i-1` is the index of the api method param, but `args` includes the method name too.
```
args[0] = method name
negativeNumberParams.get(0) = 1st parameter of method name ( i.e., args[1] )
```
I added an explanation in commit e09b821
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/4559#discussion_r498961461
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20201002/7b3df34b/attachment.html>
More information about the bisq-github
mailing list