import { IVisitor } from '../visitors/IVisitor'; /** * Base class for all node types in all data models. * @author eric.wittmann@gmail.com * @class */ export declare abstract class Node implements IVisitable { static __modelIdCounter: number; _ownerDocument: Document; _parent: Node; _modelId: number; _attributes: any; /** * Properties that are present in the source document, * but are not defined in the specification for this node, * so they can't be read directly into the data model fields. */ _extraProperties: any; _validationProblems: any; /** * Gets the owner document. * @return {Document} */ ownerDocument(): Document; /** * Returns true if this node is extensible. * @return {boolean} */ isExtensible(): boolean; /** * Gets the parent. * @return {Node} */ parent(): Node; /** * Gets the model's unique ID. * @return {number} */ modelId(): number; /** * @see io.apicurio.datamodels.core.models.IVisitable#accept(io.apicurio.datamodels.core.visitors.IVisitor) * @param {*} visitor */ abstract accept(visitor: IVisitor): any; /** * Gets a single attribute by name. * @param {string} attributeName * @return {*} */ getAttribute(attributeName: string): any; /** * Sets a single named attribute value. * @param {string} attributeName * @param {*} attributeValue */ setAttribute(attributeName: string, attributeValue: any): void; /** * Gets a collection of all the attribute names. * @return {string[]} */ getAttributeNames(): Array; /** * Deletes all attributes in the node. */ clearAttributes(): void; /** * Gets a list of all the validation problem codes for this node (and this node only). Returns * an empty list if no problems are found for this node. * @return {string[]} */ getValidationProblemCodes(): Array; /** * Gets a list of all the validation problems detected for this node. * @return {ValidationProblem[]} */ getValidationProblems(): Array; /** * Gets a list of all validation problems detected for this node, filtered by only those * problems that apply to the given property name. * @param {string} propertyName * @return {ValidationProblem[]} */ getValidationProblemsFor(propertyName: string): Array; /** * Adds a validation problem to the data model. Typically this is only used by the validation * layer when performing validation on the data model. * @param {string} errorCode * @param {NodePath} nodePath * @param {string} property * @param {string} message * @param {ValidationProblemSeverity} severity * @return {ValidationProblem} */ addValidationProblem(errorCode: string, nodePath: NodePath, property: string, message: string, severity: ValidationProblemSeverity): ValidationProblem; /** * Deletes all validation problems previously discovered for this node. Typically called by * the validation layer to reset the data model prior to performing validation. */ clearValidationProblems(): void; /** * Adds an extra property to the data model. This is called when the reader encounters a property * that is unexpected based on the expected schema. * @param {string} key * @param {*} value */ addExtraProperty(key: string, value: any): void; removeExtraProperty(name: string): any; hasExtraProperties(): boolean; getExtraPropertyNames(): Array; getExtraProperty(name: string): any; /** * Determine if this node has a parent and owner document defined. * * @throws java.lang.IllegalStateException if the state is inconsistent, i.e. one is set but not the other * @return {boolean} */ isAttached(): boolean; /** * Set this {@link io.apicurio.datamodels.core.models.Node} to have the argument as its parent, * and the same {@link io.apicurio.datamodels.core.models.Document}. * * Warning: The parent MUST attach this child node separately. * * @throws java.lang.IllegalArgumentException if the parent is not attached itself * @throws java.lang.IllegalStateException if the parent's {@link Node#isAttached()} throws the exception * @param {Node} parent */ attachToParent(parent: Node): void; constructor(); } import { ValidationProblemSeverity } from './ValidationProblemSeverity'; import { NodePath } from './NodePath'; import { ValidationProblem } from './ValidationProblem'; import { Document } from './Document'; import { IVisitable } from './IVisitable';