comparison src/implab/di/ValueDescriptor.js @ 34:27e8e9e38e07 default tip

Слияние
author nickolay
date Wed, 05 Jun 2019 20:44:15 +0300
parents 8af8e840dd49 1dc2fd263b90
children
comparison
equal deleted inserted replaced
33:8af8e840dd49 34:27e8e9e38e07
1 define([ "../declare", "./Descriptor", "../safe" ],
2
3 function(declare, Descriptor, safe) {
4 return declare(Descriptor, {
5 _value : undefined,
6 _raw : false,
7 constructor : function(value, raw) {
8 this._value = value;
9 this._raw = Boolean(raw);
10 },
11
12 activate : function(context, name) {
13 context.enter(name, this);
14 var v = this._raw ? this._value : context.parse(
15 this._value,
16 ".params");
17 context.leave(this);
18 return v;
19 },
20
21 isInstanceCreated : function() {
22 return this._raw;
23 },
24
25 getInstance : function() {
26 if (!this._raw)
27 throw new Error("The instance isn't constructed");
28 return this._value;
29 },
30
31 toString : function() {
32 if (this._raw)
33 return "@value {raw}";
34 else
35 return safe.isNull(this._value) ? "@value <null>" : "@value";
36 }
37 });
38 });