Class pvr.controller.converters._Converter
Extends
pvr.logging._LoggerMixin.
Provides an abstract base class for an object that converts values and obtains default values for a
particular data type.
Two common usages are supported:
- A default converter that provides basic type conversion.
- A converter with an associated pvr.controller._PropertyController object whose attributes influence the conversion.
Both canonical and localized formats are supported when parsing from string values or formatting to string values.
Converter classes are supported for each of the standard data types that are supported by the application. You can extend this class for any custom data types you want to support.
Each pvr.controller.attributes.Attribute object has an associated pvr.controller.converters._Converter object.
Defined in: <pvr\controller\converters\_Converter.js>.
Constructor Summary
Constructor Attributes | Constructor Name and Description |
---|---|
Method Summary
Method Attributes | Method Name and Description |
---|---|
format(value, localized, type)
Converts the specified value to a string.
|
|
Gets the default value that is supported by this converter.
|
|
parse(value, localized)
Parses a value to the type supported by this converter.
|
- Methods borrowed from class pvr.logging._LoggerMixin:
- logDebug, logEntry, logError, logExit, logInfo, logWarning
Method Detail
format(value, localized, type)
This method uses the pvr.controller.value.Value class to perform the conversion. In your extended class, you can overload the pvr.controller.converters._Converter#computeFormatSettings method to include specific controller attribute values in the settings that are passed to the pvr.controller.value.Value#to method.
- Parameters:
- value
- The value.
- localized
- Indicates whether localized of canonical formatting is required (canonical by default).
- type
- Returns:
- The converted value.
getDefaultValue()
- Returns:
- The default value.
parse(value, localized)
This method uses the pvr.controller.value.Value class to perform the conversion. In your extended class, you can overload the pvr.controller.converters._Converter#computeParseSettings method to include specific controller attribute values in the settings passed to the pvr.controller.value.Value#to method.
- Parameters:
- value
- The value.
- localized
- Indicates whether localized or canonical parsing is required (canonical by default).
- Returns:
- The converted value.