【发布时间】:2021-11-30 15:43:42
【问题描述】:
我正在构建一个与 Firestore 一起运行的应用程序,但我遇到了资金问题。
由于 Firebase 不支持 BigDecimal,我正在尝试使用 Money 类。但是显示错误java.lang.RuntimeException: Found conflicting getters for name getDefaultInstanceForType on class com.google.type.Money。
我访问了 Money 类的 Decompiled 文件,实际上有两个 getter:
In the decumentation这个类只有一个方法,所以我不知道如何进行。
这是从我的 IntelliJ IDEA 反编译的 Money 类中的问题:
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
package com.google.type;
.... HIDDEN FIELDS ....
public final class Money extends GeneratedMessageV3 implements MoneyOrBuilder {
.... HIDDEN FIELDS BY ME ....
public Money getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
.... MORE HIDDEN FIELDS ....
public Money getDefaultInstanceForType() {
return Money.getDefaultInstance();
}
.... AND MORE HIDDEN FIELDS ...
}
}
如果你想看全班,here is a link to a notion page
我该怎么办?
哦,这是我的模型(根据隐私条款,我隐藏了一些部分):
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Document(collectionName = "ModelClassCollection")
public class MyModelClass {
@DocumentId
private String id;
.... HIDDEN FIELDS ....
private Money total;
private Money municipalTax;
private Money federalTax;
}
【问题讨论】:
-
请编辑您的问题并添加您的
Money课程的内容。请编辑您的问题并将您的数据库结构添加为屏幕截图。 -
@AlexMamo 你好,我已经应用了更改。可以看看吗?
-
那里发生了太多事情。您应该隔离问题。
-
@AlexMamo 好吧,我已经隔离了它。可以看看吗?
-
你的数据库是什么样子的?
标签: java firebase google-cloud-platform google-cloud-firestore types