@accordproject/concerto-core
Version:
Core Implementation for the Concerto Modeling Language
53 lines (52 loc) • 2.23 kB
TypeScript
declare const Resource: any;
/**
* ValidatedResource is a Resource that can validate that property
* changes (or the whole instance) do not violate the structure of
* the type information associated with the instance.
* @extends Resource
* @see See {@link Resource}
* @class
* @memberof module:concerto-core
*/
declare class ValidatedResource extends Resource {
$validator: any;
/**
* This constructor should not be called directly.
* Use the Factory class to create instances.
*
* <p>
* <strong>Note: Only to be called by framework code. Applications should
* retrieve instances from {@link Factory}</strong>
* </p>
* @param {ModelManager} modelManager - The ModelManager for this instance
* @param {ClassDeclaration} classDeclaration - The class declaration for this instance.
* @param {string} ns - The namespace this instance.
* @param {string} type - The type this instance.
* @param {string} id - The identifier of this instance.
* @param {string} timestamp - The timestamp of this instance
* @param {ResourceValidator} resourceValidator - The validator to use for this instance
* @private
*/
constructor(modelManager: any, classDeclaration: any, ns: any, type: any, id: any, timestamp: any, resourceValidator: any);
/**
* Sets a property, validating that it does not violate the model
* @param {string} propName - the name of the field
* @param {string} value - the value of the property
* @throws {Error} if the value is not compatible with the model definition for the field
*/
setPropertyValue(propName: any, value: any): void;
/**
* Adds an array property value, validating that it does not violate the model
* @param {string} propName - the name of the field
* @param {string} value - the value of the property
* @throws {Error} if the value is not compatible with the model definition for the field
*/
addArrayValue(propName: any, value: any): void;
/**
* Validates the instance against its model.
*
* @throws {Error} - if the instance if invalid with respect to the model
*/
validate(): void;
}
export = ValidatedResource;