@accordproject/concerto-core
Version:
Core Implementation for the Concerto Modeling Language
52 lines (51 loc) • 1.88 kB
TypeScript
declare const Validator: any;
/**
* A Validator to enforce that a string matches a regex
* @private
* @class
* @memberof module:concerto-core
*/
declare class StringValidator extends Validator {
/**
* Create a StringValidator.
* @param {Object} field - the field or scalar declaration this validator is attached to
* @param {Object} validator - The validation string. This must be a regex
* @param {Object} lengthValidator - The length validation string - [minLength,maxLength] (inclusive).
*
* @throws {IllegalModelException}
*/
constructor(field: any, validator: any, lengthValidator: any);
/**
* Validate the property
* @param {string} identifier the identifier of the instance being validated
* @param {Object} value the value to validate
* @throws {IllegalModelException}
* @private
*/
validate(identifier: any, value: any): void;
/**
* Returns the minLength for this validator, or null if not specified
* @returns {number} the min length or null
*/
getMinLength(): any;
/**
* Returns the maxLength for this validator, or null if not specified
* @returns {number} the max length or null
*/
getMaxLength(): any;
/**
* Returns the RegExp object associated with the string validator, or null if not specified
* @returns {RegExp} the RegExp object
*/
getRegex(): any;
/**
* Determine if the validator is compatible with another validator. For the
* validators to be compatible, all values accepted by this validator must
* be accepted by the other validator.
* @param {Validator} other the other validator.
* @returns {boolean} True if this validator is compatible with the other
* validator, false otherwise.
*/
compatibleWith(other: any): boolean;
}
export = StringValidator;