grongytype:'大十进制'不匹配指定格式的类型'%d'
String stockStr = " ";
for (StockRecordDTO stockNumber : stockID)
{
stockStr+=
String.format("the stock %s for Date %s with Quantity %d ",
stockNumber.getStock(),
stockNumber.getBusinessDate(),
stockNumber.getQuantity()
);
}
我试图通过将值提取到字符串然后以这种方式打印出值来打印出值的数组列表。我正在从DTO类中获取值,并且我使用string.format
我使用的方法会遇到错误
参数类型:“大十进制”不匹配指定格式的类型'%d'
,定义为DTO类中的大十进制。
那么我该如何解决呢?
感谢您提前帮助
String stockStr = " ";
for (StockRecordDTO stockNumber : stockID)
{
stockStr+=
String.format("the stock %s for Date %s with Quantity %d ",
stockNumber.getStock(),
stockNumber.getBusinessDate(),
stockNumber.getQuantity()
);
}
I am trying to print out an ArrayList of values by extracting it to a string and then printing it this way. I am getting the Values from a DTO class, and I'm getting an error with the string.format
method I have used saying
ArgumentType: 'Big Decimal' does not match the type of the format specified '%d'
Quantity is defined as a BIG Decimal in DTO class.
So how do I solve this?
Thanks for helping in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试将
bigdeciaml
转换为double
:请小心,可能会有一个理由在类中使用
bigdeciamal
它可能会导致精确度的丧失。You could try to convert the
BigDeciaml
to adouble
:Be careful with that, there might be a reason to use
BigDeciamal
in you class and converting it to a different type might lead to loss of precision.