java—如何确定从avsc文件生成的pojo的getter和setter不存在的原因?

jmp7cifd  于 2021-07-14  发布在  Java
关注(0)|答案(0)|浏览(241)

我使用maven avro插件从avsc文件生成pojo。不幸的是,从这个文件生成的最顶层类loaninitiate似乎不包含模式中其他结构所需的任何getter和setter。
为子节点生成的pojo具有预期的getter和setter。例如,生成customer类并具有 getNameBase() 方法。
我试过用各种方式编辑这个文件——改变结构等等——但是我经常遇到格式无效的情况。
为什么会产生一些getter和setter而不是其他呢?
avro模式文件定义如下:

{
"fields": [
    {
        "name": "loanInitiate",
        "type": [
            {
                "type": "record",
                "name": "eventheader",
                "fields": [
                    {
                        "name": "eventType",
                        "type": "string",
                        "doc": "Loan"
                    },
                    {
                        "name": "eventSubtype",
                        "type": "string",
                        "doc": "Initiate"
                    },
                    {
                        "name": "eventDateTime",
                        "type": "string"
                    },
                    {
                        "name": "eventGeneratedDateTime",
                        "type": "string"
                    },
                    {
                        "name": "eventCorrelationId",
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    {
                        "name": "eventRequestId",
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    {
                        "name": "eventSourceDescription",
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    {
                        "name": "eventSource",
                        "type": [
                            "string",
                            "null"
                        ],
                        "doc": "The producer of this message."
                    },
                    {
                        "name": "eventInitiator",
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    {
                        "name": "eventBatchGroupId",
                        "type": [
                            "string",
                            "null"
                        ],
                        "doc": "BatchGroupID represents the GUID value given to each individual message which is part of a single batch."
                    },
                    {
                        "name": "eventBatchRecordCountTotal",
                        "type": [
                            "string",
                            "null"
                        ],
                        "doc": "BatchRecordCountTotal  provides the total number of messages belonging to a single batch."
                    }
                ]
            },
            {
                "type": "array",
                "name": "customer",
                "items": {
                    "name": "customer",
                    "type": "record",
                    "fields": [
                        {
                            "name": "nameBase",
                            "type": {
                                "type": "record",
                                "name": "nameBase",
                                "fields": [
                                    {
                                        "name": "givenName",
                                        "type": "string"
                                    },
                                    {
                                        "name": "otherGivenName",
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    {
                                        "name": "fullName",
                                        "type": "string"
                                    },
                                    {
                                        "name": "suffix",
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    },
                                    {
                                        "name": "surname",
                                        "type": "string"
                                    },
                                    {
                                        "name": "titlePrefix",
                                        "type": [
                                            "string",
                                            "null"
                                        ]
                                    }
                                ]
                            }
                        },
                        {
                            "name": "party",
                            "type": {
                                "type": "record",
                                "name": "party",
                                "fields": [
                                    {
                                        "name": "parentEntityId",
                                        "type": "string",
                                        "doc": "The value of this field should equal the value the id field of the parent object."
                                    },
                                    {
                                        "name": "partyRole",
                                        "type": {
                                            "type": "record",
                                            "name": "partyRole",
                                            "fields": [
                                                {
                                                    "name": "code",
                                                    "type": {
                                                        "name": "code",
                                                        "type": "enum",
                                                        "symbols": [
                                                            "INSD",
                                                            "OWNR",
                                                            "PPAY",
                                                            "RCP"
                                                        ]
                                                    }
                                                },
                                                {
                                                    "name": "subCode",
                                                    "type": {
                                                        "name": "subCode",
                                                        "type": "enum",
                                                        "symbols": [
                                                            "PRMR",
                                                            "LIST",
                                                            "BEN",
                                                            "DRBR",
                                                            "JNT"
                                                        ]
                                                    }
                                                }
                                            ]
                                        }
                                    }
                                ]
                            }
                        },
                        {
                            "name": "id",
                            "type": "string",
                            "doc": "This is the identifier for an instance of customer, which can be related to from other objects."
                        }
                    ]
                }
            },
            {
                "name": "bankAccount",
                "type": "record",
                "doc": "This object represents the bank account information, required for loan disbursements via ACH.",
                "fields": [
                    {
                        "name": "accountType",
                        "type": {
                            "name": "accountType",
                            "type": "enum",
                            "symbols": [
                                "CHKNG",
                                "SVNG"
                            ]
                        }
                    },
                    {
                        "name": "fullName",
                        "type": "string"
                    },
                    {
                        "name": "bankName",
                        "type": "string"
                    },
                    {
                        "name": "accountNumber",
                        "type": "string"
                    },
                    {
                        "name": "routingNumber",
                        "type": "string"
                    }
                ]
            },
            {
                "type": "record",
                "name": "trackingeventdetails",
                "fields": [
                    {
                        "name": "workEventIdent",
                        "type": [
                            "string",
                            "null"
                        ],
                        "doc": "This field will be populated based on the creation of a tracking work event.  This field value holds the key for that particular event."
                    },
                    {
                        "name": "applicationId",
                        "type": "string"
                    },
                    {
                        "name": "divisionCode",
                        "type": "string"
                    },
                    {
                        "name": "departmentCode",
                        "type": "string"
                    },
                    {
                        "name": "workEventNumber",
                        "type": "int"
                    },
                    {
                        "name": "longComment",
                        "type": "string"
                    },
                    {
                        "name": "actualEventDate",
                        "type": "string"
                    },
                    {
                        "name": "priorityCode",
                        "type": "string"
                    },
                    {
                        "name": "contactTypeCode",
                        "type": "string"
                    },
                    {
                        "name": "receivedDate",
                        "type": "string"
                    },
                    {
                        "name": "shortComment",
                        "type": "string"
                    },
                    {
                        "name": "lastUpdatedBy",
                        "type": "string"
                    },
                    {
                        "name": "loggedByIdent",
                        "type": "string"
                    },
                    {
                        "name": "resourceId",
                        "type": "string"
                    },
                    {
                        "name": "requestOrTypeCode",
                        "type": "string"
                    },
                    {
                        "name": "serviceChannelSourceCode",
                        "type": "string"
                    },
                    {
                        "name": "nigoCode",
                        "type": "string"
                    },
                    {
                        "name": "imageAvailableIndicator",
                        "type": "string"
                    },
                    {
                        "name": "completionIndicator",
                        "type": "string"
                    }
                ]
            },
            {
                "type": "record",
                "name": "policy",
                "fields": [
                    {
                        "name": "id",
                        "type": "int"
                    },
                    {
                        "name": "number",
                        "type": "long"
                    },
                    {
                        "name": "agreementNumberPrefix",
                        "type": "string"
                    },
                    {
                        "name": "agreementNumberSuffix",
                        "type": "string"
                    },
                    {
                        "name": "adminSystem",
                        "type": "string"
                    }
                ]
            },
            {
                "type": "record",
                "name": "loantransactiondetails",
                "doc": "This represents the values specific to the loan transaction.",
                "fields": [
                    {
                        "name": "transactionAmount",
                        "type": "string",
                        "doc": "The amount of the loan."
                    },
                    {
                        "name": "transactionType",
                        "type": "string"
                    },
                    {
                        "name": "transferAmount",
                        "type": {
                            "name": "transferAmount",
                            "type": "enum",
                            "symbols": [
                                "Max",
                                "Other"
                            ]
                        }
                    }
                ]
            }
        ]
    }
],
"type": "record",
"namespace": "com.stream.process",
"name": "loanInitiate"
}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题