File tree 4 files changed +82
-3
lines changed
4 files changed +82
-3
lines changed Original file line number Diff line number Diff line change @@ -3666,6 +3666,7 @@ public java.lang.Object produce()
3666
3666
| ** Name** | ** Description** |
3667
3667
| --- | --- |
3668
3668
| <code ><a href =" #cdk8s.Lazy.any " >any</a ></code > | * No description.* |
3669
+ | <code ><a href =" #cdk8s.Lazy.isLazy " >isLazy</a ></code > | Checks if an object is a Lazy instance. |
3669
3670
3670
3671
---
3671
3672
@@ -3683,6 +3684,24 @@ Lazy.any(IAnyProducer producer)
3683
3684
3684
3685
---
3685
3686
3687
+ ##### ` isLazy ` <a name =" isLazy " id =" cdk8s.Lazy.isLazy " ></a >
3688
+
3689
+ ``` java
3690
+ import org.cdk8s.Lazy ;
3691
+
3692
+ Lazy . isLazy(java.lang. Object obj)
3693
+ ```
3694
+
3695
+ Checks if an object is a Lazy instance.
3696
+
3697
+ ###### ` obj ` <sup >Required</sup > <a name =" obj " id =" cdk8s.Lazy.isLazy.parameter.obj " ></a >
3698
+
3699
+ - * Type:* java.lang.Object
3700
+
3701
+ The object to check.
3702
+
3703
+ ---
3704
+
3686
3705
3687
3706
3688
3707
### LazyResolver <a name =" LazyResolver " id =" cdk8s.LazyResolver " ></a >
Original file line number Diff line number Diff line change @@ -3881,6 +3881,7 @@ def produce() -> typing.Any
3881
3881
| ** Name** | ** Description** |
3882
3882
| -- - | -- - |
3883
3883
| < code>< a href=" #cdk8s.Lazy.any" > any < / a>< / code> | * No description.* |
3884
+ | < code>< a href=" #cdk8s.Lazy.isLazy" > is_lazy< / a>< / code> | Checks if an object is a Lazy instance. |
3884
3885
3885
3886
-- -
3886
3887
@@ -3900,6 +3901,26 @@ cdk8s.Lazy.any(
3900
3901
3901
3902
-- -
3902
3903
3904
+ # #### `is_lazy` <a name="is_lazy" id="cdk8s.Lazy.isLazy"></a>
3905
+
3906
+ ```python
3907
+ import cdk8s
3908
+
3909
+ cdk8s.Lazy.is_lazy(
3910
+ obj: typing.Any
3911
+ )
3912
+ ```
3913
+
3914
+ Checks if an object is a Lazy instance.
3915
+
3916
+ # ##### `obj`<sup>Required</sup> <a name="obj" id="cdk8s.Lazy.isLazy.parameter.obj"></a>
3917
+
3918
+ - * Type:* typing.Any
3919
+
3920
+ The object to check.
3921
+
3922
+ -- -
3923
+
3903
3924
3904
3925
3905
3926
# ## LazyResolver <a name="LazyResolver" id="cdk8s.LazyResolver"></a>
Original file line number Diff line number Diff line change @@ -3183,6 +3183,7 @@ public produce(): any
3183
3183
| ** Name** | ** Description** |
3184
3184
| --- | --- |
3185
3185
| <code ><a href =" #cdk8s.Lazy.any " >any</a ></code > | * No description.* |
3186
+ | <code ><a href =" #cdk8s.Lazy.isLazy " >isLazy</a ></code > | Checks if an object is a Lazy instance. |
3186
3187
3187
3188
---
3188
3189
@@ -3200,6 +3201,24 @@ Lazy.any(producer: IAnyProducer)
3200
3201
3201
3202
---
3202
3203
3204
+ ##### ` isLazy ` <a name =" isLazy " id =" cdk8s.Lazy.isLazy " ></a >
3205
+
3206
+ ``` typescript
3207
+ import { Lazy } from ' cdk8s'
3208
+
3209
+ Lazy .isLazy (obj : any )
3210
+ ```
3211
+
3212
+ Checks if an object is a Lazy instance.
3213
+
3214
+ ###### ` obj ` <sup >Required</sup > <a name =" obj " id =" cdk8s.Lazy.isLazy.parameter.obj " ></a >
3215
+
3216
+ - * Type:* any
3217
+
3218
+ The object to check.
3219
+
3220
+ ---
3221
+
3203
3222
3204
3223
3205
3224
### LazyResolver <a name =" LazyResolver " id =" cdk8s.LazyResolver " ></a >
Original file line number Diff line number Diff line change
1
+ const LAZY_SYMBOL = Symbol . for ( "cdk8s.Lazy" ) ;
2
+
1
3
export class Lazy {
2
4
public static any ( producer : IAnyProducer ) : any {
3
5
return new Lazy ( producer ) as unknown as any ;
4
6
}
5
7
6
- private constructor ( private readonly producer : IAnyProducer ) { }
8
+ /**
9
+ * Checks if an object is a Lazy instance
10
+ * @param obj The object to check
11
+ */
12
+ static isLazy ( obj : any ) : boolean {
13
+ return obj !== null && typeof obj === "object" && LAZY_SYMBOL in obj ;
14
+ }
15
+
16
+ /**
17
+ * Implements `instanceof Lazy` using the more reliable `Lazy.isLazy` static method
18
+ *
19
+ * @param obj The object to check
20
+ * @internal
21
+ */
22
+ public static [ Symbol . hasInstance ] ( obj : any ) : boolean {
23
+ return Lazy . isLazy ( obj ) ;
24
+ }
25
+
26
+ private constructor ( private readonly producer : IAnyProducer ) {
27
+ Object . defineProperty ( this , LAZY_SYMBOL , { value : true } ) ;
28
+ }
7
29
8
30
public produce ( ) : any {
9
31
return this . producer . produce ( ) ;
@@ -13,5 +35,3 @@ export class Lazy {
13
35
export interface IAnyProducer {
14
36
produce ( ) : any ;
15
37
}
16
-
17
-
You can’t perform that action at this time.
0 commit comments