@@ -323,8 +323,17 @@ fun INode.resolveProperty(role: String): IProperty {
323
323
? : throw RuntimeException (" Property '$role ' not found in concept ${c.getLongName()} " )
324
324
}
325
325
326
+ /* *
327
+ * Attempts to resolve the child link.
328
+ * @return resolved child link
329
+ * or null, if this concept has no child link or an exception was thrown during concept resolution
330
+ */
326
331
fun INode.tryResolveChildLink (role : String ): IChildLink ? {
327
- val c = this .concept ? : return null
332
+ val c = try {
333
+ this .concept ? : return null
334
+ } catch (e: RuntimeException ) {
335
+ return null
336
+ }
328
337
val allLinks = c.getAllChildLinks()
329
338
return allLinks.find { it.key(this ) == role }
330
339
? : allLinks.find { it.getSimpleName() == role }
@@ -334,8 +343,18 @@ fun INode.resolveChildLinkOrFallback(role: String?): IChildLink {
334
343
if (role == null ) return NullChildLink
335
344
return tryResolveChildLink(role) ? : IChildLink .fromName(role)
336
345
}
346
+
347
+ /* *
348
+ * Attempts to resolve the reference link.
349
+ * @return resolved reference link
350
+ * or null, if this node has no reference link or an exception was thrown during concept resolution
351
+ */
337
352
fun INode.tryResolveReferenceLink (role : String ): IReferenceLink ? {
338
- val c = this .concept ? : return null
353
+ val c = try {
354
+ this .concept ? : return null
355
+ } catch (e: RuntimeException ) {
356
+ return null
357
+ }
339
358
val allLinks = c.getAllReferenceLinks()
340
359
return allLinks.find { it.key(this ) == role }
341
360
? : allLinks.find { it.getSimpleName() == role }
@@ -344,8 +363,18 @@ fun INode.tryResolveReferenceLink(role: String): IReferenceLink? {
344
363
fun INode.resolveReferenceLinkOrFallback (role : String ): IReferenceLink {
345
364
return tryResolveReferenceLink(role) ? : IReferenceLink .fromName(role)
346
365
}
366
+
367
+ /* *
368
+ * Attempts to resolve the property.
369
+ * @return resolved property
370
+ * or null, if this node has no concept or an exception was thrown during concept resolution
371
+ */
347
372
fun INode.tryResolveProperty (role : String ): IProperty ? {
348
- val c = this .concept ? : return null
373
+ val c = try {
374
+ this .concept ? : return null
375
+ } catch (e: RuntimeException ) {
376
+ return null
377
+ }
349
378
val allLinks = c.getAllProperties()
350
379
return allLinks.find { it.key(this ) == role }
351
380
? : allLinks.find { it.getSimpleName() == role }
0 commit comments