src/models/property/simple-property.ts
Serializable REDHAWK 'simple' Property Model
Properties |
Methods |
copy |
copy()
|
Defined in src/models/property/simple-property.ts:32
|
Create a copy of the property.
Returns :
SimpleProperty
|
deserialize | ||||||||
deserialize(input: any)
|
||||||||
Defined in src/models/property/simple-property.ts:16
|
||||||||
Deserializes a JSON object into this class
Parameters :
Returns :
this
|
valueFromString | ||||||||
valueFromString(val: string)
|
||||||||
Defined in src/models/property/simple-property.ts:47
|
||||||||
Update the value from the string vs. type off this property
Parameters :
Returns :
void
|
scaType |
scaType:
|
Type : ScaSimpleType
|
Default value : 'simple'
|
Defined in src/models/property/simple-property.ts:13
|
SCA Type ('simple') |
value |
value:
|
Type : SimpleValueType
|
Defined in src/models/property/simple-property.ts:11
|
value of the property |
import { ISerializable } from '../serialization/index';
import { SimpleCommon } from './simple-common';
import { SimpleValueType } from './simple-value-type';
import { ScaSimpleType } from './sca-types';
/**
* Serializable REDHAWK 'simple' Property Model
*/
export class SimpleProperty extends SimpleCommon implements ISerializable<SimpleProperty> {
/** value of the property */
value: SimpleValueType;
/** SCA Type ('simple') */
scaType: ScaSimpleType = 'simple';
/** Deserializes a JSON object into this class */
deserialize(input: any) {
super.deserialize(input);
this.scaType = input.scaType;
this.type = input.type;
this.enumerations = input.enumerations;
if (!input.value) {
this.valueFromString('');
} else {
this.value = input.value;
}
return this;
}
/**
* Create a copy of the property.
*/
copy(): SimpleProperty {
// SimpleCommon handles type, enumerations
// This creates an initial copy as the base class,
// merges this instance's changes and then deserializes
// a copy as this class.
let p = super.copy();
p.scaType = this.scaType;
p.value = this.value;
return new SimpleProperty().deserialize(p);
}
/**
* Update the value from the string vs. type off this property
* @param val The string value to convert based on the type
*/
valueFromString(val: string) {
this.value = SimpleCommon.valueFromString(val, this.type);
}
}