Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.modelix.metamodel

import org.modelix.model.api.IChildLink
import org.modelix.model.api.INode
import org.modelix.model.api.async.IAsyncNode
import org.modelix.model.api.remove

interface ITypedChildLink<out ChildT : ITypedNode> : ITypedConceptFeature {
Expand Down Expand Up @@ -37,3 +38,6 @@ fun <ChildT : ITypedNode, ChildConceptT : INonAbstractConcept<ChildT>> INode.add

class ChildNotSetException(val node: INode, val link: ITypedMandatorySingleChildLink<*>) :
Exception("Node $node has no child in role ${link.untyped().name}")

fun IAsyncNode.getChildren(link: ITypedChildLink<ITypedNode>) =
getChildren(link.untyped().toReference())
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.modelix.metamodel

import org.modelix.model.api.INode
import org.modelix.model.api.IProperty
import org.modelix.model.api.async.IAsyncNode

interface ITypedProperty<ValueT : Any?> : ITypedConceptFeature {
fun untyped(): IProperty
Expand All @@ -14,3 +15,6 @@ fun <ValueT> INode.setTypedPropertyValue(property: ITypedProperty<ValueT>, value
fun <ValueT> INode.getTypedPropertyValue(property: ITypedProperty<ValueT>): ValueT {
return property.deserializeValue(getPropertyValue(property.untyped()))
}

fun IAsyncNode.getPropertyValue(property: ITypedProperty<String>) =
getPropertyValue(property.untyped().toReference())
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.modelix.metamodel

import org.modelix.model.api.INode
import org.modelix.model.api.IReferenceLink
import org.modelix.model.api.async.IAsyncNode

interface ITypedReferenceLink<out TargetT : ITypedNode> : ITypedConceptFeature {
fun untyped(): IReferenceLink
Expand All @@ -22,3 +23,6 @@ fun <TargetT : ITypedNode> INode.setReferenceTarget(link: ITypedReferenceLink<Ta

class ReferenceNotSetException(val node: INode, val link: ITypedReferenceLink<*>) :
Exception("Node $node has no reference target in role ${link.untyped().name}")

fun IAsyncNode.getReferenceTarget(reference: ITypedReferenceLink<ITypedNode>) =
getReferenceTarget(reference.untyped().toReference())
Loading