Skip to main content
Version: 3.10

StructureProperty 数据结构属性

1. 结构声明

class StructureProperty extends BaseNode {
name: string = '';
label?: string;
description?: string;
typeAnnotation?: TypeAnnotation;
defaultValue?: DefaultValue;
jsonName?: string;
}

2. 节点示例

(1) 示例

AST 如下:

{
"concept": "StructureProperty",
"name": "count",
"label": "数量",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
},
"description": "",
"jsonName": ""
}

对应的代码如下:

@(
label = "数量",
description = "",
jsonName = "",
)
count: Integer

(2) 示例

AST 如下:

{
"concept": "StructureProperty",
"name": "count",
"label": "数量",
"description": "订单中该商品的数量",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
},
"jsonName": "count-",
"defaultValue": {
"concept": "DefaultValue",
"expression": {
"concept": "NumericLiteral",
"value": "120",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
}
},
"playground": []
}
}

对应的代码如下:

@(
label = "数量",
description = "订单中该商品的数量",
jsonName = "count-",
)
count: Integer = 120