// ĠCopyright Ġ 2 0 0 0 - 2 0 2 0 ĠJetBrains Ġs . r . o . ĠUse Ġof Ġthis Ġsource Ġcode Ġis Ġgoverned Ġby Ġthe ĠApache Ġ 2 . 0 Ġlicense Ġthat Ġcan Ġbe Ġfound Ġin Ġthe ĠLICENSE Ġfile . Ċ package Ġcom . intellij . workspace Model . storage . entities Ċ Ċ import Ġcom . intellij . workspace Model . storage . Entity Source Ċ import Ġcom . intellij . workspace Model . storage . Workspace Entity Storage Ċ import Ġcom . intellij . workspace Model . storage . Workspace Entity Storage Builder Ċ import Ġcom . intellij . workspace Model . storage . impl . Entity Data Deleg ation Ċ import Ġcom . intellij . workspace Model . storage . impl . Mod ifiable Workspace Entity Base Ċ import Ġcom . intellij . workspace Model . storage . impl . Workspace Entity Base Ċ import Ġcom . intellij . workspace Model . storage . impl . Workspace Entity Data Ċ import Ġcom . intellij . workspace Model . storage . impl . references . Mutable One ToOne Child Ċ import Ġcom . intellij . workspace Model . storage . impl . references . Mutable One ToOne Parent Ċ import Ġcom . intellij . workspace Model . storage . impl . references . One ToOne Child Ċ import Ġcom . intellij . workspace Model . storage . impl . references . One ToOne Parent Ċ Ċ // Ġ------------------- ĠParent ĠEntity Ġ-------------------------------- Ċ Ċ internal Ġclass ĠO o Parent Entity Data Ġ: ĠWorkspace Entity Data < Oo Parent Entity >() Ġ{ ĊĊĠ Ġlateinit Ġvar Ġparent Property : ĠString ĊĊĠ Ġoverride Ġfun Ġcreate Entity ( snapshot : ĠWorkspace Entity Storage ): ĠO o Parent Entity Ġ{ ĊĠĠĠ Ġreturn ĠO o Parent Entity ( parent Property ). also Ġ{ Ġadd MetaData ( it , Ġsnapshot ) Ġ} ĊĠ Ġ} Ċ } Ċ Ċ internal Ġclass ĠO o Parent Entity ( val Ġparent Property : ĠString ) Ġ: ĠWorkspace Entity Base () Ġ{ ĊĊĠ Ġval Ġchild : ĠO o Child Entity ? Ġby ĠOne ToOne Parent . Nullable < Oo Parent Entity , ĠO o Child Entity >( Oo Child Entity :: class . java , Ġfalse ) Ċ } Ċ Ċ internal Ġclass ĠMod ifiable Oo Parent Entity Ġ: ĠMod ifiable Workspace Entity Base < Oo Parent Entity >() Ġ{ ĊĠ Ġvar Ġparent Property : ĠString Ġby ĠEntity Data Deleg ation () ĊĠ Ġvar Ġchild : ĠO o Child Entity ? Ġby ĠMutable One ToOne Parent . Nullable ( Oo Parent Entity :: class . java , ĠO o Child Entity :: class . java , Ġfalse ) Ċ } Ċ Ċ internal Ġfun ĠWorkspace Entity Storage Builder . add Oo Parent Entity ( parent Property : ĠString Ġ= Ġ" parent ", Ġsource : ĠEntity Source Ġ= ĠMy Source ): ĠO o Parent Entity Ġ{ ĊĠ Ġreturn Ġadd Entity ( Mod ifiable Oo Parent Entity :: class . java , Ġsource ) Ġ{ ĊĠĠĠ Ġthis . parent Property Ġ= Ġparent Property ĊĠ Ġ} Ċ } Ċ Ċ // Ġ---------------- ĠChild Ġentity Ġ---------------- ------ Ċ Ċ internal Ġclass ĠO o Child Entity Data Ġ: ĠWorkspace Entity Data < Oo Child Entity >() Ġ{ ĊĠ Ġlateinit Ġvar Ġchild Property : ĠString ĊĠ Ġoverride Ġfun Ġcreate Entity ( snapshot : ĠWorkspace Entity Storage ): ĠO o Child Entity Ġ{ ĊĠĠĠ Ġreturn ĠO o Child Entity ( child Property ). also Ġ{ Ġadd MetaData ( it , Ġsnapshot ) Ġ} ĊĠ Ġ} Ċ } Ċ Ċ internal Ġclass ĠO o Child Entity ( val Ġchild Property : ĠString ) Ġ: ĠWorkspace Entity Base () Ġ{ ĊĠ Ġval Ġparent : ĠO o Parent Entity Ġby ĠOne ToOne Child . NotNull ( Oo Parent Entity :: class . java , Ġtrue ) Ċ } Ċ Ċ internal Ġclass ĠMod ifiable Oo Child Entity Ġ: ĠMod ifiable Workspace Entity Base < Oo Child Entity >() Ġ{ ĊĠ Ġvar Ġchild Property : ĠString Ġby ĠEntity Data Deleg ation () ĊĠ Ġvar Ġparent : ĠO o Parent Entity Ġby ĠMutable One ToOne Child . NotNull ( Oo Child Entity :: class . java , ĠO o Parent Entity :: class . java , Ġtrue ) Ċ } ĊĊ Ċ internal Ġfun ĠWorkspace Entity Storage Builder . add Oo Child Entity ( Oo Parent Entity : ĠO o Parent Entity , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġchild Property : ĠString Ġ= Ġ" child ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġsource : ĠEntity Source Ġ= ĠMy Source ) Ġ= ĊĠ Ġadd Entity ( Mod ifiable Oo Child Entity :: class . java , Ġsource ) Ġ{ ĊĠĠĠ Ġthis . parent Ġ= ĠO o Parent Entity ĊĠĠĠ Ġthis . child Property Ġ= Ġchild Property ĊĠ Ġ} Ċ