Skip to main content
Version: 3.3

Structure 数据结构

1. 结构声明

class Structure extends BaseNode {
name: string = '';
description: string;
typeParams?: Array<TypeParam>;
properties: Array<StructureProperty>;
}

2. 节点示例

(1) 示例

AST 如下:

{
"concept": "Structure",
"name": "ProductOrder",
"description": "",
"properties": [
{
"concept": "StructureProperty",
"name": "product",
"label": "商品",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "reference",
"typeNamespace": "app.dataSources.defaultDS.entities",
"typeName": "Product",
"inferred": false,
"ruleMap": {}
},
"jsonName": "",
"description": "",
"required": false,
"defaultValue": ""
},
{
"concept": "StructureProperty",
"name": "order",
"label": "订单",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "reference",
"typeNamespace": "app.dataSources.defaultDS.entities",
"typeName": "OrderForm",
"inferred": false,
"ruleMap": {}
},
"jsonName": "",
"description": "",
"required": false,
"defaultValue": ""
},
{
"concept": "StructureProperty",
"name": "count",
"label": "数量",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
},
"jsonName": "",
"description": "",
"required": false,
"defaultValue": ""
}
]
}

(2) 带描述的示例

AST 如下:

{
"concept": "Structure",
"name": "ProductOrder",
"description": "表示商品订单的结构",
"properties": [
{
"concept": "StructureProperty",
"name": "product",
"label": "商品",
"description": "商品属性",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "reference",
"typeNamespace": "app.dataSources.defaultDS.entities",
"typeName": "Product",
"inferred": false,
"ruleMap": {}
},
"jsonName": "product-",
"required": false,
"defaultValue": ""
},
{
"concept": "StructureProperty",
"name": "order",
"label": "订单",
"description": "订单属性",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "reference",
"typeNamespace": "app.dataSources.defaultDS.entities",
"typeName": "OrderForm",
"inferred": false,
"ruleMap": {}
},
"jsonName": "order-",
"required": false,
"defaultValue": ""
},
{
"concept": "StructureProperty",
"name": "count",
"label": "数量",
"description": "订单中该商品的数量",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
},
"jsonName": "count-",
"required": false,
"defaultValue": "120"
}
]
}

(3) 示例

AST 如下:

{
"concept": "Structure",
"name": "ExtendedList",
"description": "",
"typeParams": [
{
"concept": "TypeParam",
"name": "T"
}
],
"properties": [
{
"concept": "StructureProperty",
"name": "length",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Integer",
"inferred": false,
"ruleMap": {}
},
"description": "",
"required": false,
"defaultValue": "",
"jsonName": ""
}
]
}