import {PersistentAnnotation} from '../PersistentAnnotation'; import {PersistentFactory} from '../PersistentFactory'; import {FieldConverter} from './FieldConverter'; /** * 数组编号持久化器。 * * @param item 内容 * @param config 设置 * @param annotation 描述器 */ export class BooleanConverter extends FieldConverter { /** * 加载设置信息。 * * @param factory 工厂 * @param context 环境 * @param item 内容 * @param config 设置 * @param annotation 描述器 */ public load(factory: PersistentFactory, context: any, item: any, config: any, annotation?: PersistentAnnotation) { var name = annotation.name; var dataName = annotation.dataName; var value = config[name]; item[dataName] = value ? true : false; } /** * 存储设置信息。 * * @param factory 工厂 * @param context 环境 * @param item 内容 * @param config 设置 * @param annotation 描述器 */ public save(factory: PersistentFactory, context: any, item: any, config: any, annotation?: PersistentAnnotation) { var name = annotation.name; var dataName = annotation.dataName; var value = item[name]; config[dataName] = value ? true : false; } }