Closed peterzhuamazon closed 1 month ago
These are the getters setup today: https://github.com/opensearch-project/automation-app/blob/9b4854bec987ef7bb674b45932de4cc556104587/src/service/operation/operation.ts#L16-L27
A better way:
export class Operation { private _name: string; private _events: string[]; private _tasks: Task[]; constructor(name: string, events: string[], tasks: Task[]) { this._name = name; this._events = events; this._tasks = tasks; } public get name(): string { return this._name; } public get events(): string[] { return this._events; } public get tasks(): Task[] { return this._tasks; } }
Even better we can just use readonly:
export class Operation { readonly name: string; readonly events: string[]; readonly tasks: Task[]; constructor(name: string, events: string[], tasks: Task[]) { this.name = name; this.events = events; this.tasks = tasks; } }
Thanks.
These are the getters setup today: https://github.com/opensearch-project/automation-app/blob/9b4854bec987ef7bb674b45932de4cc556104587/src/service/operation/operation.ts#L16-L27
A better way:
Even better we can just use readonly:
Thanks.