Quantcast
Channel: Square Developer Forums - Latest topics
Viewing all articles
Browse latest Browse all 1334

Optional fields in new Java API

$
0
0

The new Java SDK has practically all fields has Optional<> rather than the previous String, int, etc. This makes it much more cumbersome to work with - e.g. location.name().orElse(null).
Is there some feature in the SDK or in Java that makes this easier to deal with or must we do .get()/.orElse() on each field?

A real example:

RefundPaymentResponse resp = ...;
double refunded = resp.getRefund().get().getAmountMoney().getAmount().get()/100.0;

4 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 1334

Trending Articles