UNPKG

@bitloops/bl-transpiler

Version:
44 lines 1.75 kB
import { DomainServiceNode } from '../nodes/domain-service/DomainServiceNode.js'; export class DomainServiceNodeBuilder { domainServiceNode; identifierNode; parameterListNode; publicMethodListNode; privateMethodListNode; intermediateASTTree; constructor(intermediateASTTree, metadata) { this.intermediateASTTree = intermediateASTTree; this.domainServiceNode = new 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; } } //# sourceMappingURL=DomainServiceNodeBuilder.js.map