Java 从JSON模式为非对象类型生成POJO
我试图从XMBC的JSON模式生成POJO。 我是用你的手做这件事的。 但是,没有生成任何内容。它甚至没有给我带来一个错误 这是我试图从中生成的简化json模式示例:Java 从JSON模式为非对象类型生成POJO,java,json,code-generation,jsonschema,Java,Json,Code Generation,Jsonschema,我试图从XMBC的JSON模式生成POJO。 我是用你的手做这件事的。 但是,没有生成任何内容。它甚至没有给我带来一个错误 这是我试图从中生成的简化json模式示例: { "description": "JSON-RPC API of XBMC", "id": "http://xbmc.org/jsonrpc/ServiceDescription.json", "methods": { "Addons.ExecuteAddon": { "description":
{
"description": "JSON-RPC API of XBMC",
"id": "http://xbmc.org/jsonrpc/ServiceDescription.json",
"methods": {
"Addons.ExecuteAddon": {
"description": "Executes the given addon with the given parameters (if possible)",
"params": [
{
"name": "addonid",
"required": true,
"type": "string"
},
{
"default": "",
"name": "params",
"type": [
{
"additionalProperties": {
"default": "",
"type": "string"
},
"type": "object"
},
{
"items": {
"type": "string"
},
"type": "array"
},
{
"description": "URL path (must start with / or ?",
"type": "string"
}
]
},
{
"default": false,
"name": "wait",
"type": "boolean"
}
],
"returns": {
"type": "string"
},
"type": "method"
}
},
"notifications": {
"Application.OnVolumeChanged": {
"description": "The volume of the application has changed.",
"params": [
{
"name": "sender",
"required": true,
"type": "string"
},
{
"name": "data",
"properties": {
"muted": {
"required": true,
"type": "boolean"
},
"volume": {
"maximum": 100,
"minimum": 0,
"required": true,
"type": "integer"
}
},
"required": true,
"type": "object"
}
],
"returns": null,
"type": "notification"
}
},
"types": {
"Addon.Content": {
"default": "unknown",
"enums": [
"unknown",
"video",
"audio",
"image",
"executable"
],
"id": "Addon.Content",
"type": "string"
}
},
"version": "6.14.3"
}
我必须承认,我对JSON的了解非常简洁,也许这只是我的一个简单错误。但是有谁能帮助我如何从这样的JSON模式生成Java对象吗?JSON模式不支持方法。JSON模式定义JSON数据结构,它不会用于定义方法。JSON模式中最重要的属性是
properties
可以从JSON模式生成POJO数据模型,但不能从业务逻辑生成POJO数据模型。您可以从中学习JSON模式