Add TypeChecker and use its methods wherever possible.

This commit is contained in:
László Monda
2016-03-30 01:59:05 +02:00
parent 94e5d55d8f
commit 0edde3236a
7 changed files with 18 additions and 20 deletions

View File

@@ -10,16 +10,12 @@ class SwitchKeymapAction extends KeyAction implements Serializable<SwitchKeymapA
}
set keymapId(value) {
if (!SwitchKeymapAction.isKeymapIdValid(value)) {
if (!TypeChecker.isUInt8Valid(value)) {
throw 'Invalid SwitchKeymapAction.keymapId: ${value}';
}
this._keymapId = value;
}
static isKeymapIdValid(keymapId) {
return 0 <= keymapId && keymapId <= 255;
}
fromJsObject(jsObject: any): SwitchKeymapAction {
this.keymapId = jsObject.keymapId;
return this;