A unique identifier for the specific implementation, like "RequireText" or "Range". Its value appears in the IssueFound that comes from Validation, and in IssueFound that comes from retrieving a list of errors to display. It allows the consumer of both to correlate those instances with the specific condition. When defining conditions through a ConditionConfig, the Type property must be assigned with a valid ConditionType. This property always returns what the user supplied in the Config.conditionType, not the default conditiontype. That allows multiple instances of the same condition Class to participate in one validator's list of conditions, because each has a unique ConditionType.
Data that supports the business rule defined in evaluate(). Consider this immutable. Expect to create a new Condition instance if its data needs to be changed.
Helps identify the purpose of the Condition. Impacts:
Protected
defaultMost of time, this represents a pattern that defines a data type, like USPhoneNumber and EmailAddress. Sometimes, the user develops a regular expression with another purpose, like checking an area code of a USPhoneNumber. They should set ConditionConfig.category to Contents
Static
DefaultProtected
getReturn a RegExp for EvaluateString to use.
Protected
evaluateApplies the business rule against the string value (already trimmed if Config.trim is true).
Protected
loggerProvides an API for logging, sending entries to the loggerService.
Implementation for IMessageTokenSource. Conditions havea number of values that are appropriate for tokens on the ConditionConfig. Examples:
An array. If an empty array if there are no token to offer. This base class has no tokens to offer.
Protected
generateUtility to create a condition to use as a child condition. It uses the conditionFactory. If the factory throws an exception, it logs the error and returns a condition that always returns Undetermined to allow execution to continue.
Protected
tryConverts the given value and lookup key using the provided conversion lookup key. If the conversion fails, a warning log is generated. Takes no action if the conversionLookupKey is null.
The value to be converted.
The lookup key associated with the value. Often this should be assigned to valueHost.getDataType().
The conversion lookup key to be used for conversion. Often this comes from conversionLookupKey or secondConversionLookupKey found on the Config object.
The services
An object containing the converted value, lookup key, and a flag indicating if the conversion failed.
Optional
value?: anyOptional
lookupProtected
ensureProtected
logUtility to log when a conditionConfig property is incorrectly setup.
Protected
throwLogs the invalid property data and throws a CodingError.
The name of the invalid property.
The error message describing the invalid property data.
The value host services.
Protected
logReport a comparison error where the data types of the two values are mismatched.
Protected
logLogs a message indicating that the specified property lacks a value to evaluate.
The name of the property.
The value host services.
Protected
ensureSupports evaluate() implementations by checking the valueHost passed in is setup and if not, supplying one identified by ConditionConfig.valueHostName. ConditionConfig.valueHostName takes precidence over the valueHost passed in.
Protected
getA service to provide all ValueHostNames that have been assigned to this Condition's Config.
Evaluate a value using its business rule and configuration in the Config.
contains both the value from input field/element and the native value resolved by data type. This function checks both in valueHost to determine a string source.
Runs when Config.supportsDuringEdit is true and validateOptions.DuringEdit is true Supports the Config.trim option.
When supportsDuringEdit is false, returns undetermined. Otherwise it follows the rules from the Config.
Protected
resolveSupplies the value found in ValueHost from getValue(). It wants a string and will only return a string or undefined.
Generated using TypeDoc v0.25.12
Evaluates the native value, which must be a string, against a regular expression. This implementation has the user supply the regular expression through RegExpConditionConfig.
Supports validateOptions.duringEdit = true so long as Config.supportsDuringEdit is true or undefined.