@hashgraph/solo
Version:
An opinionated CLI tool to deploy and manage private Hedera Networks.
35 lines • 1.34 kB
JavaScript
// SPDX-License-Identifier: Apache-2.0
import { MissingParentResourceReferenceError as MissingParentResourceReferenceError } from '../errors/missing-parent-resource-reference-error.js';
import { MissingResourceNameError } from '../errors/missing-resource-name-error.js';
export class NestedResourceReference {
parentReference;
name;
constructor(parentReference, name) {
this.parentReference = parentReference;
this.name = name;
if (!parentReference) {
throw new MissingParentResourceReferenceError();
}
if (!name) {
throw new MissingResourceNameError();
}
}
/**
* Compares this instance with another NestedResourceReference.
* @param other The other NestedResourceReference instance.
* @returns true if both instances have the same parent reference and name.
*/
equals(other) {
return (other instanceof NestedResourceReference &&
this.parentReference.equals(other.parentReference) &&
this.name.equals(other.name));
}
/**
* Allows implicit conversion to a string.
* @returns The nested resource reference as a string.
*/
toString() {
return `{parentRef: ${this.parentReference}, name: ${this.name}}`;
}
}
//# sourceMappingURL=nested-resource-reference.js.map