Service for changing the original value into something that you want a condition to evaluate using IDataTypeConverter instances.

interface IDataTypeConverterService {
    lazyLoad: ((service) => void);
    serviceName: string;
    services: IServices;
    convert(value, sourceLookupKey, resultLookupKey): ConversionResult;
    convertUntilResult(value, sourceLookupKey, resultLookupKey): ConversionResult;
    find(value, sourceLookupKey, resultLookupKey): null | IDataTypeConverter;
    compatibleSources(value, sourceLookupKey): IDataTypeConverter[];
    register(item): void;
    getAll(): IDataTypeConverter[];
    dispose(): void;
}

Hierarchy (view full)

Implemented by

Properties

lazyLoad: ((service) => void)

Sets up a function to lazy load the configuration when any of the other functions are called. This function can be set after some initial registration. It will be discarded immediately after its used.

Type declaration

serviceName: string
services: IServices

Provides access to services.

Methods

  • Return the value converted from the original value to the desired resultLookupKey. It may be a reworking of the original value, such as a Date object converted to a number of seconds, or a number rounded to an integer. Return null if the value represents null. Return undefined if the value was unconvertable. See also convertUntilResult() for a more complex conversion.

    Parameters

    • value: any

      The value to be converted. Check its type and possibly its content.

    • sourceLookupKey: null | string

      The value can represent several other values, such as a Date represents date, time, etc. Use this when you need to distinguish between them. If null or '', evaluate the value itself, such as checking its class (using 'instanceof') or for properties of an interface that you are using. This is often the dataType property of the ValueHost.

    • resultLookupKey: string

    Returns ConversionResult

    An object identifying the converter used and the converted value. Its value parameter is undefined when the value was not converted. Its converterUsed parameter is undefined when no DataTypeConverter could be found to try the conversion. Note that DataTypeConverter.convert() can return undefined, allowing for value=undefined and converterUsed=assigned.

    Result Lookup Key

    • The lookup key that the result should be. When handling conditions, this is usually from conditionConfig.conversionLookupKey or secondConversionLookupKey.
  • Applies a converter specific to the value based on the desired result lookup key. If the result is an object (like Date or custom), it repeats with the new value, hopefully resulting in a primitive value for use by the DefaultComparer. Date -> number using UTCDateConverter RelativeDate class with getDate(): Date property -> Date -> number using RelativeDateConverter and UTCDateConverter.

    Parameters

    • value: any

      The value to be converted. Check its type and possibly its content.

    • sourceLookupKey: null | string

      The value can represent several other values, such as a Date represents date, time, etc. Use this when you need to distinguish between them. If null or '', evaluate the value itself, such as checking its class (using 'instanceof') or for properties of an interface that you are using. This is often the dataType property of the ValueHost.

    • resultLookupKey: string

    Returns ConversionResult

    An object identifying the converter used and the converted value. Its value parameter is undefined when the value was not converted. Its converterUsed parameter is undefined when no DataTypeConverter could be found to try the conversion. Note that DataTypeConverter.convert() can return undefined, allowing for value=undefined and converterUsed=assigned.

    Result Lookup Key

    • The lookup key that the result should be. When handling conditions, this is usually from conditionConfig.conversionLookupKey or secondConversionLookupKey.
  • Finds the first IDataTypeConverter that supports the value, or null if none are found.

    Parameters

    • value: any

      The value to be converted. Check its type and possibly its content.

    • sourceLookupKey: null | string

      The value can represent several other values, such as a Date represents date, time, etc. Use this when you need to distinguish between them. If null or '', evaluate the value itself, such as checking its class (using 'instanceof') or for properties of an interface that you are using. This is often the dataType property of the ValueHost.

    • resultLookupKey: string

    Returns null | IDataTypeConverter

    Result Lookup Key

    • The lookup key that the result should be. When handling conditions, this is usually from conditionConfig.conversionLookupKey or secondConversionLookupKey.
  • If the user needs to abandon this instance, they should use this to clean up active resources (like timers) and to release memory that would stall the garbage collector from disposing this object. It should assign any object reference to undefined as a strong indicator that the object has been disposed.

    Returns void

Generated using TypeDoc v0.25.12