Skip to main content
Version: 3.5

NewComposite 实体/(匿名)数据结构构造器

1. 结构声明

class NewComposite extends LogicItem {
typeAnnotation: TypeAnnotation;
properties: Array<Identifier>;
rights: Array<SelectMembers>;
assignmentLines: Array<AssignmentLine>;
hideProperties: boolean = false;
hideDefaults: boolean = false;
autoConnection: boolean = true;
}

2. 节点示例

(1) 示例

AST 如下:

{
"concept": "NewComposite",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "reference",
"typeNamespace": "app.dataSources.defaultDS.entities",
"typeName": "Student",
"inferred": false,
"ruleMap": {}
},
"properties": [
{
"concept": "Identifier",
"namespace": "",
"name": "id"
},
{
"concept": "Identifier",
"namespace": "",
"name": "createdTime"
},
{
"concept": "Identifier",
"namespace": "",
"name": "updatedTime"
},
{
"concept": "Identifier",
"namespace": "",
"name": "createdBy"
},
{
"concept": "Identifier",
"namespace": "",
"name": "updatedBy"
},
{
"concept": "Identifier",
"namespace": "",
"name": "name"
}
],
"rights": [
{
"concept": "SelectMembers",
"hideMembers": false,
"expression": {
"concept": "StringLiteral",
"value": "学生甲"
},
"members": []
}
],
"assignmentLines": [
{
"concept": "AssignmentLine",
"leftIndex": [
0,
5
],
"rightIndex": [
0
]
}
],
"hideProperties": false,
"hideDefaults": false,
"autoConnection": true
}

(2) 新建匿名数据结构

AST 如下:

{
"concept": "NewComposite",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "anonymousStructure",
"typeNamespace": "",
"typeName": "",
"inferred": false,
"ruleMap": {},
"properties": [
{
"concept": "StructureProperty",
"name": "name",
"required": true
},
{
"concept": "StructureProperty",
"name": "age",
"required": true
}
]
},
"properties": [
{
"concept": "Identifier",
"namespace": "",
"name": "name"
},
{
"concept": "Identifier",
"namespace": "",
"name": "age"
}
],
"rights": [
{
"concept": "SelectMembers",
"hideMembers": false,
"expression": {
"concept": "NumericLiteral",
"value": "24",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
}
},
"members": []
},
{
"concept": "SelectMembers",
"hideMembers": false,
"expression": {
"concept": "StringLiteral",
"value": "学生甲"
},
"members": []
}
],
"assignmentLines": [
{
"concept": "AssignmentLine",
"leftIndex": [
0,
0
],
"rightIndex": [
1
]
},
{
"concept": "AssignmentLine",
"leftIndex": [
0,
1
],
"rightIndex": [
0
]
}
],
"hideProperties": false,
"hideDefaults": false,
"autoConnection": true
}