UNPKG

@bitloops/bl-transpiler

Version:
48 lines 1.95 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DomainServiceNodeBuilder = void 0; const DomainServiceNode_js_1 = require("../nodes/domain-service/DomainServiceNode.js"); class DomainServiceNodeBuilder { domainServiceNode; identifierNode; parameterListNode; publicMethodListNode; privateMethodListNode; intermediateASTTree; constructor(intermediateASTTree, metadata) { this.intermediateASTTree = intermediateASTTree; this.domainServiceNode = new DomainServiceNode_js_1.DomainServiceNode(metadata); } withIdentifier(domainServiceIdentifierNode) { this.identifierNode = domainServiceIdentifierNode; const domainServiceName = domainServiceIdentifierNode.getIdentifierName(); this.domainServiceNode.setClassName(domainServiceName); return this; } withParameters(parameterListNode) { this.parameterListNode = parameterListNode; return this; } withPublicMethods(publicMethodListNode) { this.publicMethodListNode = publicMethodListNode; return this; } withPrivateMethods(privateMethodListNode) { this.privateMethodListNode = privateMethodListNode; return this; } build() { this.intermediateASTTree.insertChild(this.domainServiceNode); this.intermediateASTTree.insertChild(this.identifierNode); this.intermediateASTTree.insertSibling(this.parameterListNode); this.intermediateASTTree.insertSibling(this.publicMethodListNode); if (this.privateMethodListNode) { this.intermediateASTTree.insertSibling(this.privateMethodListNode); } this.intermediateASTTree.setCurrentNodeToRoot(); this.domainServiceNode.buildObjectValue(); return this.domainServiceNode; } } exports.DomainServiceNodeBuilder = DomainServiceNodeBuilder; //# sourceMappingURL=DomainServiceNodeBuilder.js.map