【发布时间】:2015-01-19 06:53:10
【问题描述】:
我正在使用 jsonschema2pojo 来生成 POJO。它工作正常。 但我想从单个 json 模式文件生成多个 POJO。 这是否可以使用 jsonschema2pojo 插件。
生成多个 POJO 的一种方法是提供多个 json 模式文件,但我不想这样做。我只想提供一个 json 模式文件作为输入。
我提供以下 json 模式作为输入:
{
"Address": {
"description": "AnAddressfollowingtheconventionofhttp: //microformats.org/wiki/hcard",
"type": "object",
"properties": {
"post-office-box": {
"type": "string"
},
"post-office-address": {
"type": "string"
}
},
"additionalProperties": false
},
"AddressDetails": {
"description": "AnAddressDetailsfollowingtheconventionofhttp: //microformats.org/wiki/hcard",
"type": "object",
"properties": {
"post-office-box": {
"type": "string"
},
"post-office-address": {
"type": "string"
}
}
}
}
以上架构是有效架构,但没有创建任何内容。我不知道我是否遗漏了什么,或者使用 jsonschema2pojo 是不可能的。
还有没有办法在运行时生成这些实体?
如果有人对此有任何想法,请分享。
【问题讨论】:
标签: java json jsonschema jsonschema2pojo